1
noe132 2017-09-25 17:21:18 +08:00 via Android 1
The Attr node inherits from Node, but is not considered a part of the document tree. Common Node attributes like parentNode, previousSibling, and nextSibling are null for an Attr node. You can, however, get the element to which the attribute belongs with the ownerElement property.
children is a HTMLCollection, which is an ordered collection of DOM elements that are children of node. If there are no element children, then children contains no elements and has a length of 0. children 只包含 dom nodes。The Attr node inherits from Node, but is not considered a part of the document tree https://developer.mozilla.org/en-US/docs/Web/API/element/getAttributeNode https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/children |
2
Newyorkcity OP @noe132 我去寻找了一下 document tree 的知识,想确定 nodeType 总共 12 个值对应 12 种 node,到底哪些是被 document tree 认可并且收入树模型里的,但没找到,请问你有相关资料吗?
另外这个过程里我看了 nodeType 的资料 https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType,其中声明 ATTRIBUTE_NODE 等元素『已被弃用』……我现在推测是不是哪些在被弃用列表中的 node 都不会再进入 document tree 了呢? |