[Bug 5851] Consider adding .toArray() on NodeList and HTMLCollection

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5851


crisp <crisp@tweakers.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crisp@tweakers.net




--- Comment #1 from crisp <crisp@tweakers.net>  2008-07-10 23:04:05 ---
'live collections' are not a bug; they are a design feature and you could use
that to your advantage. They are on the other side often misunderstood or not
anticipated which could lead to bugs or unexpected results.

On the other hand it is already quite easy to convert such collections to an
array in a browser that has implemented Array in a generic way so that it also
works on interface objects:

var foo = document.getElementsByTagName('div');
var staticFoo = [].slice.call(foo, 0);

the toArray() could then easily be implemented by prototyping NodeList or
HTMLCollection (don't know which one or which browsers actually support that)

I'd rather see a specification that says that Array methods should be generic
and thus also work on interface objects (that can be accessed like an array
having a length property and all) and that interface objects should be
first-class javascript objects and thus be expandable.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 10 July 2008 23:04:45 UTC