[whatwg] Adding ECMAScript 5 array extras to HTMLCollection

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