DOM/domcore/Document

From W3C Wiki
< DOM‎ | domcore
Jump to: navigation, search

Document

The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.


Attributes

Name Description
implementation Returns the DOM implementation associated with this document.
compatMode Indicates whether the document is rendered in Quirks or Strict mode.
doctype Returns the Document Type Declaration associated with this document.
documentElement Allows direct access to the child node that is the document element of the document.


Methods

Name Description
getElementsByTagName(localName) Returns a list of all the Elements in document order with a given local name(tag name).
getElementsByTagNameNS(namespace, localName) Returns a list of all the Elements with a given local name and namespace URI in document order.
getElementsByClassName(classNames) Returns the Element that has an class attribute with the given value.
getElementById(elementId) Returns the Element that has an ID attribute with the given value.
createElement(localName) Creates an element of the type specified.
createElementNS(namespace, qualifiedName) Creates an element of the given qualified name and namespace URI.
createDocumentFragment() Creates an empty DocumentFragment object.
createTextNode(data) Creates a Text node given the specified string.
createComment(data) Creates a Comment node given the specified string.
createProcessingInstruction(target, data) Creates a ProcessingInstruction node given the specified name and data strings.
importNode(node, deep) Imports a node from another document to this document
adoptNode(node) Attempts to adopt a node from another document to this document.


DOM Core reference

DOM Core specification defines the Interface Document in 5.5 Interface Document.