Document in DOM Level 2 Core
The Document interface represents the entire HTML or XML document.
Inherits from:
Inherited by:
For official information please see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#i-Document.
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 |
|---|---|---|
| appendChild() | Node | [from Node] |
| cloneNode() | Node | Return a new copy of the node.[from Node] |
| createAttribute() | Attr | |
| createAttributeNS() | Attr | |
| createCDATASection() | CDATASection | |
| createComment() | Comment | |
| createDocumentFragment() | DocumentFragment | |
| createElement() | DocumentFragment | |
| createElementNS() | Element | |
| createEntityReference() | EntityReference | |
| createProcessingInstruction() | ProcessingInstruction | |
| createTextNode() | Text | Create a new Text node, with optional content. |
| getElementById() | Element | |
| getElementsByTagName() | NodeList | |
| getElementsByTagNameNS() | NodeList | |
| hasAttributes() | Boolean | [from Node] |
| hasChildNodes() | Boolean | [from Node] |
| importNode() | Node | Imports a node from another document to this document. |
| insertBefore() | Node | [from Node] |
| isSupported() | Boolean | [from Node] |
| normalize() | (none) | [from Node] |
| removeChild() | Node | [from Node] |
| replaceChild() | Node | [from Node] |
Description
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() | DOMImplementation |