Document in DOM Level 2 Core
The Document interface represents the entire HTML or XML document.
Inherits from:
Inerhited 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 |
|---|---|---|
| doctype | DocumentType | (read only) |
| implementation | DOMImplementation | (read only) |
| documentElement | Element | (read only) |
| nodeName | String | (read only) [from Node] |
| nodeValue | String | [from Node] |
| nodeType | Number | (read only) [from Node] |
| parentNode | Node | (read only) [from Node] |
| childNodes | NodeList | (read only) [from Node] |
| firstChild | Node | (read only) [from Node] |
| lastChild | Node | (read only) [from Node] |
| previousSibling | Node | (read only) [from Node] |
| nextSibling | Node | (read only) [from Node] |
| attributes | NamedNodeMap | (read only) [from Node] |
| ownerDocument | Document | (read only) [from Node] |
| namespaceURI | String | (read only) [from Node] |
| prefix | String | [from Node] |
| localName | String | (read only) [from Node] |
Instance Methods
| name | returns | description |
|---|---|---|
| createElement() | DocumentFragment | |
| createComment() | Comment | |
| createCDATASection() | CDATASection | |
| createProcessingInstruction() | ProcessingInstruction | |
| createAttribute() | Attr | |
| createEntityReference() | EntityReference | |
| getElementsByTagName() | NodeList | |
| importNode() | Node | Imports a node from another document to this document. |
| createElementNS() | Element | |
| createAttributeNS() | Attr | |
| getElementsByTagNameNS() | NodeList | |
| getElementById() | Element | |
| insertBefore() | Node | [from Node] |
| replaceChild() | Node | [from Node] |
| removeChild() | Node | [from Node] |
| appendChild() | Node | [from Node] |
| cloneNode() | Node | Return a new copy of the node. [from Node] |
| isSupported() | Boolean | [from Node] |
| createDocumentFragment() | DocumentFragment | |
| hasChildNodes() | Boolean | [from Node] |
| normalize() | (none) | [from Node] |
| hasAttributes() | Boolean | [from Node] |
| createTextNode() | Text | Create a new Text node, with optional content. |
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 |