Re: NodeList.toArray()

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 UTC