W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2010

Re: NodeList.toArray()

From: Jeff Schiller <codedread@gmail.com>
Date: Thu, 26 Aug 2010 14:55:56 -0700
Message-ID: <AANLkTin9Ggz9vtuXpCGKcmGNFYC3tC0_KfPb0t_eSo9d@mail.gmail.com>
To: www-dom@w3.org
Of course I later realized that if I want a static NodeList I should just be
using querySelector().

Never mind!

Jeff

On Tue, Aug 24, 2010 at 4:37 PM, Jeff Schiller <codedread@gmail.com> wrote:

> This has probably been suggested before, but here goes.
>
> Sometimes you need a live NodeList (even though they can be poor
> performers) and sometimes you simply want an array-like object that isn't
> "live".
>
> 1) I propose adding a simple method to the NodeList interface:
>
>
> interface NodeList <http://core.html#ID-536297177> {
>   Node <http://core.html#ID-1950641247>               item <http://core.html#ID-844377136>(in unsigned long index);
>   readonly attribute unsigned long   length <http://core.html#ID-203510337>;
>
> *  Node[]             toArray();*
> };
>
>
> toArray() returns a static array of Node elements.
>
> 2) I notice that I never see arrays represented in DOM IDLs.  It might be
> that I missed it, but I suspect it's because I don't understand something
> about the IDLs - maybe they are trying to be language-neutral?  Can this get
> fixed?  What software language doesn't have an array-like construct?  If
> there's ultimately no nice way to represent an array in IDL syntax (?) then
> I would suggest defining a dummy array-like collection that is not live - is
> there such a beast?
>
> Jeff
>
Received on Thursday, 26 August 2010 21:56:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:05 GMT