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
firstChild: https://developer.mozilla.org/zh-CN/docs/Web/API/Node/firstChild
firstElementChild: https://developer.mozilla.org/zh-CN/docs/Web/API/ParentNode/firstElementChild
The text was updated successfully, but these errors were encountered:
Gecko内核(**Firefox**)的浏览器会在源代码中标签内部有空白符的地方插入一个文本结点到文档中.因此,使用诸如 Node.firstChild 和 Node.previousSibling 之类的方法可能会引用到一个空白符文本节点, 而不是使用者所预期得到的节点.
所以获取某元素的第一个子元素,我们应该用 firstElementChild,但是要注意浏览器兼容问题(IE8、IE9 和 Safari 需要添加 Polyfill)
Sorry, something went wrong.
No branches or pull requests
firstChild: https://developer.mozilla.org/zh-CN/docs/Web/API/Node/firstChild
firstElementChild: https://developer.mozilla.org/zh-CN/docs/Web/API/ParentNode/firstElementChild
The text was updated successfully, but these errors were encountered: