Document in DOM Level 2 Core

The Document interface represents the entire HTML or XML document.

For more information see

Inherits from:

Inerhited by:

Instance Properties

name type description
attributes NamedNodeMap (read only) [from Node]
childNodes NodeList (read only) [from Node]
doctype DocumentType (read only)
documentElement Element (read only)
firstChild Node (read only) [from Node]
implementation DOMImplementation (read only)
lastChild Node (read only) [from Node]
localName String (read only) [from Node]
namespaceURI String (read only) [from Node]
nextSibling Node (read only) [from Node]
nodeName String (read only) [from Node]
nodeType Number (read only) [from Node]
nodeValue String [from Node]
ownerDocument Document (read only) [from Node]
parentNode Node (read only) [from Node]
prefix String [from Node]
previousSibling Node (read only) [from Node]

Instance Methods

name returns description
addEventListener(type,listener,useCapture) (none) [from EventTarget]
appendChild(newChild) Node [from Node]
cloneNode(deep) Node Return a new copy of the node. [from Node]
createAttribute(name) Attr
createAttributeNS(namespaceURI,qualifiedName) Attr
createCDATASection(data) CDATASection
createComment(data) Comment
createDocumentFragment() DocumentFragment
createElement(tagName) DocumentFragment
createElementNS(namespaceURI,qualifiedName) Element
createEntityReference(name) EntityReference
createProcessingInstruction(target,data) ProcessingInstruction
createTextNode([data]) Text Create a new Text node, with optional content.
dispatchEvent(evt) Boolean Dispatches an event to the invoking object. [from EventTarget]
getElementById(elementId) Element
getElementsByTagName(tagname) NodeList
getElementsByTagNameNS(namespaceURI,localName) NodeList
hasAttributes() Boolean [from Node]
hasChildNodes() Boolean [from Node]
importNode(importedNode,deep) Node Imports a node from another document to this document.
insertBefore(newChild,refChild) Node [from Node]
isSupported(feature,version) Boolean [from Node]
normalize() (none) [from Node]
removeChild(oldChild) Node [from Node]
removeEventListener(type,listener,useCapture) (none) [from EventTarget]
replaceChild(newChild,oldChild) Node [from Node]



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.

Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of a Document, the Document interface also contains the factory methods needed to create these objects. The Node objects created have a ownerDocument attribute which associates them with the Document within whose context they were created.

Properties that are a Document

name object description
contentDocument [html] HTMLObjectElement (read only)
contentDocument [html] HTMLFrameElement (read only)
contentDocument [html] HTMLIFrameElement (read only)
ownerDocument Node (read only)

Methods that return a Document

name of object description
createDocument(namespaceURI,qualifiedName,doctype) DOMImplementation