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

NodeList.toArray() returns the incorrect type #12

Open
orslumen opened this issue Mar 20, 2011 · 0 comments
Open

NodeList.toArray() returns the incorrect type #12

orslumen opened this issue Mar 20, 2011 · 0 comments

Comments

@orslumen
Copy link

When parsing a Document Fragment, the appendChild method calls Array.prototype.push.apply(nodelist, newChild.childNodes.toArray() );

But as NodeList.toArray() returns self, you will receive Exception TypeError: Function.prototype.apply: Arguments list has wrong type.

I got around this issue by putting back the original toArray() method:
toArray: function () {
var children = [];
for ( var i=0; i < this.length; i++) {
children.push (this[i]);
}
return children;
},

See commit orslumen@bb3c8db

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

1 participant