We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
佬好! 在js的dom笔记中我有一个疑问:
<body> <div id="box"> <p>我是段落A</p> <p id="para">我是段落B</p> <p>我是段落C</p> </div> <script> var box = document.getElementById('box'); var para = document.getElementById('para'); console.log(box.firstChild.nodeType);
这里nodetype的输出是3,但是我并不明白是为什么。于是我去询问了下gpt,得到了答案: 根据W3C标准,nodeType 的值定义如下:
1 - Element 节点 2 - Attribute 节点(已废弃) 3 - Text 节点 4 - CDATASection 节点(仅在 XML 中有效) 5 - EntityReference 节点(已废弃) 6 - Entity 节点(已废弃) 7 - ProcessingInstruction 节点 8 - Comment 节点 9 - Document 节点 10 - DocumentType 节点 11 - DocumentFragment 节点 12 - Notation 节点(已废弃) 第一个节点是多出的空行text,因此返回3.我觉得这里的笔记好像没有讲到nodetype对应的值的问题,因此拉了一个issue,希望您能看到!!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
佬好!
在js的dom笔记中我有一个疑问:
这里nodetype的输出是3,但是我并不明白是为什么。于是我去询问了下gpt,得到了答案:
根据W3C标准,nodeType 的值定义如下:
1 - Element 节点
2 - Attribute 节点(已废弃)
3 - Text 节点
4 - CDATASection 节点(仅在 XML 中有效)
5 - EntityReference 节点(已废弃)
6 - Entity 节点(已废弃)
7 - ProcessingInstruction 节点
8 - Comment 节点
9 - Document 节点
10 - DocumentType 节点
11 - DocumentFragment 节点
12 - Notation 节点(已废弃)
第一个节点是多出的空行text,因此返回3.我觉得这里的笔记好像没有讲到nodetype对应的值的问题,因此拉了一个issue,希望您能看到!!
The text was updated successfully, but these errors were encountered: