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
- The title attribute is the title of the document as specified by the TITLE element.
- The referrer attribute returns the URI of the page that linked to this page.
- The domain attribute contains the name of the server that served the document.
- The URL contains the complete URI of this document.
- The body attribute returns the BODY element for documents with BODY contents.
- The body attribute returns the outermost FRAMESET element for frameset documents.
- The images is a collection of all IMG elements of the document.
- The applets attribute is a collection of all the OBJECT elements that include applets and APPLET elements in a document.
- The links attribute is a collection of all AREA elements and anchor(A) in a document.
- The forms attribute is a collection of the forms of a document.
- The anchors attribute is a collection of all the anchor(A) elements in a document with a value for the name attribute.
- The cookie attribute returns the empty string if there are no cookies associated with this document.
Methods
- The getElementsById(elementId) method returns the Element whose id is given by elementId.
- The getElementsById(elementId) method returns null if there is no such element whose id is given by elementId.
- 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