The Dom Tree Model Of A Web Page
THE DOM TREE MODEL OF A WEB PAGE
As a browser loads a web page, it creates a model of that page.
The model is called a DOM tree, and it's stored in the browser's memory.
The DOM tree consists of four main types of nodes:
1. Document Node: The top tree which represents the entire page.
2. Element Nodes: The HTML elements that describe the structure of the page.
<h1> - <h6>, <p>, etc.
3. Attribute Nodes: HTML attributes. These are NOT children of the element that carries them. They are part of that element.
4. Text Nodes: The words within the element. These cannot have children.
Let's look at an HTML page and it's DOM tree...
Each node in the DOM tree is an object with methods and properties.
Scripts access and update this DOM tree.
(not the source HTML file)
Any changes made in the DOM will reflect in the browser.