[whatwg] Adding ECMAScript 5 array extras to HTMLCollection

Mike Shaver mike.shaver at gmail.com
Fri Jul 30 06:50:05 PDT 2010


On Fri, Jul 30, 2010 at 12:43 AM, Oliver Hunt <oliver at apple.com> wrote:
> The various html collections aren't fixed length, they're not assignable, so they can't used interchangeably with arrays at the best of times.

Array generics work on arrays that aren't fixed-length, perhaps
obviously, and I believe they're still valid over arrays which have
had their indexed properties configured to be unwritable as well.  As
your later example shows, they can be used interchangeably with arrays
at exactly the best of times: when wanting to apply a non-mutating
extra to one!

We've got the array statics in Firefox (Array.forEach, etc.) and it's
made the make-collections-be-arrays cries from those working on
front-end JS subside dramatically.  I think they would probably solve
the problem quite effectively, and not require us to be on the lookout
for naming collisions between future Array.prototype and
HTMLCollection fields.

Mike



More information about the whatwg mailing list