What is a node in Javascript?

后端 未结 4 1287
隐瞒了意图╮
隐瞒了意图╮ 2021-01-30 03:14

I was wondering what exactly a node is in JavaScript?

As in the functions:

element.nodeType
row.parentNode.removeChild(row);
4条回答
  •  情歌与酒
    2021-01-30 03:57

    Nodes are in the DOM aka Document Object model. In the DOM, all parts of the document, such as elements, attributes, text, etc. are organized in a hierarchical tree-like structure; consisting of parents and children. These individual parts of the document are known as nodes.

    The topmost node is the root node (Document Node) of the DOM tree, which has one child, the element and so on. Further, the text content inside an element is a child node of the parent element, for example, "Mobile OS" is considered as a child node of the

    that contains it, and so on. Comments inside the HTML document are nodes in the DOM tree as well even though they dont effect the document in any way. HTML attributes such as id, class, title, style, etc. are also considered as nodes in DOM hierarchy.

提交回复
热议问题