Skip to content
New issue

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

ParentNode.children属性不是符合W3C标准规范的属性 #1

Closed
AlexZhong22c opened this issue Mar 12, 2017 · 1 comment
Closed

Comments

@AlexZhong22c
Copy link

AlexZhong22c commented Mar 12, 2017

斌斌学院js任务三
ParentNode.children属性不是符合W3C标准规范的属性,我个人认为用Node.childNodes取代它比较好一点

@giscafer
Copy link
Owner

children是Element的属性,childNodes是Node的属性

Node是Element的父类。

https://developer.mozilla.org/en-US/docs/Web/API/Element

Element的children[0]仍为Element,是Node和Element的实例,Node的childNdoes[0]为Node,只是Node的实例,不是Element的实例。

只要清楚操作对象是什么类型的实例就可以了,用什么都可以。参考博客:http://www.cnblogs.com/jscode/archive/2012/09/04/2670819.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants