jerry-z-j-r / i-love-you-3-thousand Goto Github PK
View Code? Open in Web Editor NEW“求知若饥,虚心若愚” —— Steve Jobs.
License: Other
“求知若饥,虚心若愚” —— Steve Jobs.
License: Other
佬好!
在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,希望您能看到!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.