《JavaScript权威指南》第四版,第四部分中提到Document对象继承了HTMLElement对象的所有属性,但是这两个对象一点也不沾边啊,请高手指点他们的继承关系。

解决方案 »

  1.   

    从DOM2看是这样的:
    interface HTMLDocument : Document {
               attribute DOMString       title;
      readonly attribute DOMString       referrer;
      readonly attribute DOMString       domain;
      readonly attribute DOMString       URL;
               attribute HTMLElement     body;
      readonly attribute HTMLCollection  images;
      readonly attribute HTMLCollection  applets;
      readonly attribute HTMLCollection  links;
      readonly attribute HTMLCollection  forms;
      readonly attribute HTMLCollection  anchors;
               attribute DOMString       cookie;
                                            // raises(DOMException) on setting  void               open();
      void               close();
      void               write(in DOMString text);
      void               writeln(in DOMString text);
      NodeList           getElementsByName(in DOMString elementName);
    };
      

  2.   

    htmlelement只有可怜的几个属性:
    interface HTMLElement : Element {
               attribute DOMString       id;
               attribute DOMString       title;
               attribute DOMString       lang;
               attribute DOMString       dir;
               attribute DOMString       className;
    };