W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > July 2008

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

From: <bugzilla@wiggum.w3.org>
Date: Thu, 10 Jul 2008 23:04:05 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1KH5BF-0005kE-LV@wiggum.w3.org>


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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:00:45 UTC