Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

javascript - 创建一个HTMLCollection(create a HTMLCollection)

I'm trying to shim Element.prototype.children which should return a HTMLCollection

(我正在尝试对应该返回HTMLCollection的 Element.prototype.children进行填充)

There is a window.HTMLCollection

(有一个window.HTMLCollection)

However

(然而)

var h = new HTMLCollection();
//TypeErrror: HTMLCollection is not a constructor

and

(和)

var h = Object.create(HTMLCollection.prototype);
h[0] = div;
h.item(0); 
// Could not convert JavaScript argument

Test Firefox 7 and Chrome

(测试Firefox 7和Chrome)

Apart from shimming HTMLCollection is there any way to interact with it?

(除了HTMLCollection之外,还可以与它进行交互吗?)

Also provide feedback on this github issue if you can suggest a solution

(如果您可以提出解决方案,还请提供有关此github问题的反馈)

  ask by Raynos translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...