2.2 Document

The Document interface inherits from the Node interface and 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 the other nodes such as elements, text nodes, comments, and processing instructions 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.