NodeList.toArray()

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 <core.html#ID-536297177> {
  Node <core.html#ID-1950641247>               item
<core.html#ID-844377136>(in unsigned long index);
  readonly attribute unsigned long   length <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 Tuesday, 24 August 2010 23:38:14 UTC