The Document Object Model
The DOM as a Tree Structure

Tree-like modeling is used in many fields, including evolutionary science and data analytics. Perhaps you’re already familiar with the concept of family trees: these charts represent the familial relationships amongst the descendants of a given family name.

The DOM tree follows similar logic to that of a family tree. A family tree is made up of family members and their relationships to the family name. In computer science, we would call each family member a node.

We define a node as an intersecting point in a tree that contains data.

In the DOM tree, the top-most node is called the root node, and it represents the HTML document. The descendants of the root node are the HTML tags in the document, starting with the <html> tag followed by the <head> and <body> tags and so on.


The diagram to the right models the HTML document and labels the root element, which is the document.

Observe the difference in the rectangular boxes and the curved boxes. These denote a difference in the types of nodes in the DOM structure.

Folder Icon

Sign up to start coding

Already have an account?