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

[whatwg] Adding ECMAScript 5 array extras to HTMLCollection

From: Maciej Stachowiak <mjs@apple.com>
Date: Wed, 04 Aug 2010 15:01:15 -0700
Message-ID: <BE55939B-7082-452E-8341-7AAB704035F5@apple.com>

On Aug 4, 2010, at 2:40 PM, Jonas Sicking wrote:

> On Wed, Aug 4, 2010 at 11:10 AM, Alex Russell <slightlyoff at google.com> wrote:
>> Sorry for the lagged response,
>> 
>> On Fri, Jul 30, 2010 at 2:56 PM, Oliver Hunt <oliver at apple.com> wrote:
>>> 
>>> On Jul 30, 2010, at 2:46 PM, Alex Russell wrote:
>>> 
>>>> Wait...what? Shouldn't some sort of NodeList be mutable? And shouldn't
>>>> JS support immutable Arrays? We need to fix both of these APIs, and we
>>>> keep heaping back-pressure on JavaScript's Array without any
>>>> reasonable resolution because we're not exploring how to make Array
>>>> subtypes work as we want them to for all the use cases (like this)
>>>> that we care to express.
>>> 
>>> What would you expect a mutable NodeList to be?
>> 
>> A good example would be the result of document.querySelectorAll().
> 
> Why couldn't querySelectorAll return a normal Array?

I think in principle it could, but it might be too much compat risk to do now.

Returning a fully mutable array would also remove the opportunities to cache and reuse the return value, since each result would really need to be distinct if they are mutable.

Regards,
Maciej
Received on Wednesday, 4 August 2010 15:01:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:59 UTC