W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: [DOM4] NodeList should be deprecated

From: Rick Waldron <waldron.rick@gmail.com>
Date: Tue, 13 Mar 2012 22:27:12 -0400
Message-ID: <CAHfnhfr+-dGmKcW1ufvO5Gnr7JYbrn5TFiQHJFPSjdO-8Uw56A@mail.gmail.com>
To: Ojan Vafai <ojan@chromium.org>
Cc: Anne van Kesteren <annevk@opera.com>, Adam Klein <adamk@chromium.org>, WebApps WG <public-webapps@w3.org>, Erik Arvidsson <arv@chromium.org>, Ryosuke Niwa <rniwa@chromium.org>
On Tue, Mar 13, 2012 at 10:24 PM, Ojan Vafai <ojan@chromium.org> wrote:

> Upon further thought, I take this suggestion back. Static NodeList as it
> currently exists is just an underpowered array, but that doesn't mean
> that's what it always has to be. In the future, we should add methods to
> NodeList that operate on Nodes, e.g. add a remove method to NodeList that
> call remove on all the Nodes in the NodeList. Also, in theory, browser may
> be able to optimize common cases of NodeLists (e.g. cache frequently
> accessed NodeLists).
>
> We should make static NodeList inherit from Array though so that you can
> do regular array operations on it.
>

In the future, it will be incredibly easy to make a NodeList into an Array
with the spread operator:

[ ...NodeList ]

// [ node, node, node ]

Rick



>
>
> On Tue, Mar 13, 2012 at 5:59 AM, Rick Waldron <waldron.rick@gmail.com>wrote:
>
>>
>> On Mar 13, 2012, at 4:29 AM, "Anne van Kesteren" <annevk@opera.com>
>> wrote:
>>
>> > On Mon, 12 Mar 2012 21:06:00 +0100, Rick Waldron <
>> waldron.rick@gmail.com> wrote:
>> >> On Mar 12, 2012, at 3:06 PM, "Anne van Kesteren" <annevk@opera.com>
>> wrote:
>> >>> On Mon, 12 Mar 2012 19:07:31 +0100, Rick Waldron <
>> waldron.rick@gmail.com> wrote:
>> >>>> The NodeList item() method is a blocker.
>> >>>
>> >>> Blocker in what way?
>> >>
>> >> As I've always understood it - the item() method is what
>> differentiates NodeList from Array and blocks it from being "just an array".
>> >>
>> >> Is this incorrect?
>> >
>> > I think there is more, such as arrays being mutable, but the suggestion
>> was to change two accessors from mutation observers to return platform
>> array objects rather than NodeLists, which is a change we can still make
>> given that mutation observers is not widely deployed yet.
>>
>> I that case, very cool. Thanks for the clarification.
>>
>> >
>> >
>> > --
>> > Anne van Kesteren
>> > http://annevankesteren.nl/
>>
>
>
Received on Wednesday, 14 March 2012 02:28:00 GMT

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