我试图对
有一个
然而,
Element.prototype.children
进行补丁,它应该返回一个 HTMLCollection。有一个
window.HTMLCollection
。然而,
var h = new HTMLCollection();
//TypeErrror: HTMLCollection is not a constructor
与
var h = Object.create(HTMLCollection.prototype);
h[0] = div;
h.item(0);
// Could not convert JavaScript argument
测试Firefox 7和Chrome
除了使用shim技术转换HTMLCollection,还有其他方法可以与它进行交互吗?
如果您能提出解决方案,请在此GitHub问题中提供反馈。
MyHTMLCollection
构造函数,然后使用它来代替不可靠的宿主构造函数HTMLCollection
。 - Šime Vidas