The Document object is the root of a document tree.
The Document object gives us access to the document's data.
Since element nodes, text nodes, attributes, comments, etc. cannot exist outside the document, the Document object contains methods to create these objects. All Node objects have a ownerDocument property which associates them with the Document where they were created.
Note: The Document object can also use the properties and methods of the Node object.
![]()
The Document object is supported in all major browsers.
The "DOM" column indicates in which DOM Level the property was introduced.
| Property | Description | DOM |
|---|---|---|
| doctype | Returns the Document Type Declaration associated with the document | 1 |
| documentElement | Returns the Document Element of the document (the HTML element) | 1 |
| documentURI | Sets or returns the location of the document | 3 |
| domConfig | Returns the configuration used when normalizeDocument() is invoked | 3 |
| implementation | Returns the DOMImplementation object that handles this document | 1 |
| inputEncoding | Returns the encoding, character set, used for the document | 3 |
| strictErrorChecking | Sets or returns whether error-checking is enforced or not | 3 |
| xmlEncoding | Returns the XML encoding of the XML document | 3 |
| xmlStandalone | Sets or returns whether the XML document is standalone or not | 3 |
| xmlVersion | Sets or returns the XML version of the XML document | 3 |
The "DOM" column indicates in which DOM Level the method was introduced.
| Method | Description | DOM |
|---|---|---|
| adoptNode(node) | Adopts a node from another document to this document. Returns the adopted node | 3 |
| createAttribute() | Creates an attribute node | 1 |
| createAttributeNS(URI,name) | Creates an attribute with the specified name and namspaceURI | 2 |
| createCDATASection() | Creates a CDATA node with the specified text. For XML DOM only | 1 |
| createComment() | Creates a Comment node with the specified text | 1 |
| createDocumentFragment() | Creates an empty DocumentFragment node | 1 |
| createElement() | Creates an Element node | 1 |
| createElementNS() | Creates an element with the specified namespace | 2 |
| createEntityReference() | Creates an EntityReference node. For XML DOM only | 1 |
| createProcessingInstruction() | Creates an EntityReference node. For XML DOM only | 1 |
| createTextNode() | Creates a Text node | 1 |
| getElementById() | Returns the element that has the ID attribute with the specified value | 2 |
| getElementsByTagName() | Returns a NodeList containing all elements with the specified tagname | 1 |
| getElementsByTagNameNS() | Returns a NodeList containing all elements with the specified namespaceURI and tagname | 2 |
| importNode() | Imports a node from another document | 2 |
| normalizeDocument() | Removes empty Text nodes, and joins adjacent nodes | 3 |
| renameNode() | Renames the specified node | 3 |
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.