W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

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

From: Julien Richard-Foy <julien@richard-foy.fr>
Date: Thu, 25 Aug 2011 08:47:21 +0200
Message-Id: <2B3EEBAD-BE10-484C-A45E-62D23B645359@richard-foy.fr>
Cc: Aryeh Gregor <ayg@aryeh.name>, "public-webapps@w3.org" <public-webapps@w3.org>
To: Jonas Sicking <jonas@sicking.cc>

On 25 août 2011, at 08:33, Jonas Sicking <jonas@sicking.cc> wrote:

> On Wed, Aug 24, 2011 at 12:04 PM, Aryeh Gregor <ayg@aryeh.name> wrote:
>> On Wed, Aug 24, 2011 at 1:27 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>>> I agree with this, but it might be too late to make this change.
>>> 
>>> The problem is that if we returned an Array object, it would not have
>>> a .item function, which the currently returned NodeList has.
>>> 
>>> I guess we could return a Array object and add a .item function to it.
>> 
>> Or return a NodeList and add .forEach/.filter/etc. to it?
> 
> That works, but what is the advantage? And .push/.pop or other
> mutating functions wouldn't work.

All mutable functions will work (forEach, map, etc.) and bring a better expressiveness to the code.
> 
Received on Thursday, 25 August 2011 06:47:52 GMT

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