[whatwg] Adding ECMAScript 5 array extras to HTMLCollection

Erik Arvidsson arv at chromium.org
Mon Apr 26 10:38:24 PDT 2010


> Rather that trying to make DOM collections feel like arrays, how about just
> giving them a toArray() method?  This makes it clear that a collection is
> not an array, but clearly defines a way to obtain an array.  Clever
> implementors might even be able to optimize common uses-cases using some
> kind of copy-on-write strategy so that toArray() doesn't involve memory
> allocation and copying.

That might be better than nothing but why should a NodeList not have a
forEach method? It is pretty clear that people want to be able to
treat Arguments and NodeList as Arrays.

-- 
erik



More information about the whatwg mailing list