RESOLVED DUPLICATE of bug 76591 17184
Node.childNodes returns a new NodeList each time
https://bugs.webkit.org/show_bug.cgi?id=17184
Summary Node.childNodes returns a new NodeList each time
boucher
Reported 2008-02-05 12:52:47 PST
The NodeList object, which is returned by element.childNodes, among other things, cannot have properties assigned to it. It also doesn't have any of the built in array functions. Firefox (and I believe Internet Explorer, but cannot test right this moment) supports adding aribtrary properties to the objects returned by element.childNodes, as well as the built in array functions on those objects. This is related to the following two bugs: http://bugs.webkit.org/show_bug.cgi?id=8080 http://bugs.webkit.org/show_bug.cgi?id=7967 These bugs note that it doesn't respond to for..in, and that similarly Collections returned from a form element can't have properties set.
Attachments
boucher
Comment 1 2008-02-05 13:00:12 PST
Apparently the actual problem here is that every time you call element.childNodes, you get a new NodeList. So, the following will not work: element.childNodes.foo = 1; alert(element.childNodes.foo); //undefined But, this does work: var e = element.childNodes; e.foo = 1; alert(e.foo); Obviously the severity of this is significantly less now, since the alternate method is acceptable. Though it would be ideal if two immediate requests to element.childNodes returned the same list.
Alexey Proskuryakov
Comment 2 2010-11-30 12:23:43 PST
See also: bug 9508, bug 33696.
Pablo Flouret
Comment 3 2012-02-17 15:15:07 PST
Looks like this one got fixed by bug 76591.
Adam Barth
Comment 4 2012-02-17 15:16:41 PST
*** This bug has been marked as a duplicate of bug 76591 ***
Note You need to log in before you can comment on or make changes to this bug.