HTMLDocument Interface

An HTMLDocument is the root of the HTML hierarchy and hold the entire content.



IDL Definition

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;
 Element                                       getElementsById(in DOMString elementId);
 NodeList                                      getElementsByName(in DOMString elementName); 
};

Semantic Requirements

  1. The title attribute is the title of the document as specified by the TITLE element.
  2. The referrer attribute returns the URI of the page that linked to this page.
  3. The domain attribute contains the name of the server that served the document.
  4. The URL contains the complete URI of this document.
  5. The body attribute returns the BODY element for documents with BODY contents.
  6. The body attribute returns the outermost FRAMESET element for frameset documents.
  7. The images is a collection of all IMG elements of the document.
  8. The applets attribute is a collection of all the OBJECT elements that include applets and APPLET elements in a document.
  9. The links attribute is a collection of all AREA elements and anchor(A) in a document.
  10. The forms attribute is a collection of the forms of a document.
  11. The anchors attribute is a collection of all the anchor(A) elements in a document with a value for the name attribute.
  12. The cookie attribute returns the empty string if there are no cookies associated with this document.
  13. Methods

  14. The getElementsById(elementId) method returns the Element whose id is given by elementId.
  15. The getElementsById(elementId) method returns null if there is no such element whose id is given by elementId.
  16. The getElementsByName(elementName) method returns (possibly empty) the collection of elements whose name is given by elementName.

If you have comments or suggestions, email me at mbrady@nist.gov