W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2010

[whatwg] Adding ECMAScript 5 array extras to HTMLCollection

From: And Clover <and-py@doxdesk.com>
Date: Mon, 26 Apr 2010 19:50:56 +0200
Message-ID: <4BD5D280.30706@doxdesk.com>
David Flanagan wrote:

> Rather that trying to make DOM collections feel like arrays, how about 
> just giving them a toArray() method?

I like that, as a practical and explicit (JavaScript-specific) binding.

In the longer term, what's the thinking on a more basic change:

- Require specific DOM interfaces like NodeList, HTMLCollection, Element 
etc. to be available for prototype monkey-patching under their interface 
names as properties of `window`?

Then we wouldn't have to worry about what Array-like methods need to be 
provided on HTMLCollection, because application and framework authors 
could choose whichever they liked to prototype in.

IE8/Moz/Op/Saf/Chr already do this to a significant extent, but there's 
no standard that says they have to. It would allow DOM extension to be 
put on a much less shaky footing than the messy hack Prototype 1.x uses.

Is this something that's a reasonable requirement for browsers in future?

And Clover
mailto:and at doxdesk.com
Received on Monday, 26 April 2010 10:50:56 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:22 UTC