How to understand the relationship between the three tiers of DOM

In addition to the root node, the other node has three tiers relationship .

Parent relationship ( parentNode ): the direct parent node

The relationship between the child nodes ( childNodes ): direct subordinate node

Siblings relationship ( sibling ): has a parent node of the same node

 

Note:
1. root and non-root node can not have child nodes, but not necessarily the root parent, rather than the root must have, and there is only one parent.

2. There can be multiple child nodes, the parent node can have only one.

3. siblings, also known as siblings, they have the same parent, but the child node is not the same.

4. In js, the root node document.

Guess you like

Origin www.cnblogs.com/aisowe/p/11491312.html