THE DOCUMENT TREE
When a browser loads a page, it creates a
hierarchical representation of its contents which closely resembles its HTML
structure. This results in a tree-like organization of nodes, each representing
an element, an attribute, content or some other object.
Nodes
Each of these different object types will have
their own unique methods and properties. But each also implements the Node
interface. This is a common set of methods and properties related to the
document tree structure. To understand this interface better, take a look a the
diagram below which represents a simple node tree.
The Document Root
The document object serves as the root of this node
tree. It too implements the Node interface. It will have child nodes but no
parent node or sibling nodes, as it is the starting node. In addition to being
a Node, it also implements the Document interface.
This
interface provides methods for accessing and creating other nodes in the
document tree. Some methods are:
+
getElementById()
+
getElementsByTagName()
+
createElement()
+
createAttribute()
+
createTextNode()
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.