This content has been automatically translated from Ukrainian.
Dom Hierarchy (Document Object Model) consists of objects that represent the structure of an HTML or XML document in the form of a tree. here is described in a little more detail about what a DOM is. And now let's consider the main levels of the DOM hierarchy:
Document
A root object that represents the document itself. It contains all other DOM objects and is an entry point for accessing other elements.
Element
Nodes that represent HTML tags (eg <div>, <p>, <a>). Items can have attributes, text content, and nested items.
Attribute
Attributes that store additional information about items. For example, the attribute class, id, href, etc.
Text
Nodes that represent the text content of an element. They are children of elements, but cannot have their children.
Comment
Nodes that represent comments in an HTML or XML document.
DocumentFragment
Used to create and manipulate a group of nodes without affecting the real document until those nodes are added to the document.
Node
General class for all nodes in the DOM. Other nodes, such as Element, Text, and Comment, are subtypes of Node.
The DOM hierarchy works like a tree, where each element is a node (node), and each node can have child nodes, forming a tree-like structure with a root in Document and leaves at the level of text nodes or comments.
This post doesn't have any additions from the author yet.