W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: [selectors-api] Return an Array instead of a static NodeList

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 24 Oct 2011 15:39:26 -0700
Message-ID: <CA+c2ei-6c6UvLEJ5dzORYSuaPP688qB72xbewE5QOw_qQ0qVBw@mail.gmail.com>
To: Cameron McCormack <cam@mcc.id.au>
Cc: Aryeh Gregor <ayg@aryeh.name>, Julien Richard-Foy <julien@richard-foy.fr>, public-webapps@w3.org
On Mon, Oct 24, 2011 at 3:02 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> On 24/10/11 12:14 PM, Jonas Sicking wrote:
>>
>> Based on my testing, many methods wouldn't throw for zero-size
>> array-like objects. Similarly, methods like .push(), .unshift() and
>> .slice() wouldn't throw if no entries were actually requested to be
>> added or removed. And .reverse() wouldn't throw for single-sized
>> array-like objects.
>>
>> May or may not be a big deal though.
>
> Yeah.  IMO it's not.
>
> One thing that is difficult to reflect from the JS Array API to objects like
> HTMLInputElements.files which we might want to make mutable is that the
> former is designed to work with sparse arrays while we have typically
> considered DOM collection/list objects as dense.
>
>  myFileInput.files.length;    // let's say this is 1
>  myFileInput.files[2] = ...;  // what does this mean?

Indeed. Though I think we can deal with having holes. We'd just have
to compact whenever the list was changed (in this case if the user
modified the list of files).

/ Jonas
Received on Monday, 24 October 2011 22:40:28 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:48 GMT