This article briefly introduces the nodes in the DOM model. There are three nodes in the DOM model: Element nodes, attribute nodes, and text nodes, I believe that you have a deep understanding of the DOM model nodes through this article.
Nodes in the DOM Model
There are three nodes in the DOM model: Element Node, attribute node, and text node.
Element Node
It can be said that the entire DOM model is composed of element nodes. Element nodes can contain other elements. For example, <li> can be contained in <ul>. Only the root element HTML is not included.
Attribute node
As an element in a page, there are more or less attributes. For example, almost all elements have the title attribute. Developers can use these attributes to make more accurate descriptions of objects contained in elements. For example:
- <Ahrefahref = http://www.sutao123.cn
- Title = "I am the master of my data network"> I am the master of my data network </a>
In the above Code, href = "http://www.sutao123.cn" and title = "my profile I am the master" are two attribute nodes. Because attributes are placed in tags, attribute nodes are always included in element nodes.
Text Node
In HTML, it is not enough to build a framework. The purpose of the page is to display content to users. For example, in the above example, "my data network is my master" is a text node that we want to display to users. This section briefly introduces the DOM model nodes.