On 4/10/11 4:30 AM, Lachlan Hunt wrote:
Would it be useful, and is it possible to define the refElements
parameter to accept any object that contains a .length and indexed
properties, just like a JQuery object?

Looks like this already got answered, but yes, sequence<Node> should make that work.

OK. Then I'm not sure what the practical difference between the
Element[] or sequence<Element> would be then, nor which one to use.

I'm not either.  That's why Cameron is cced.

If using webidl array/sequence types, that would help with the
iteration, but not the large allocation.

OK, does that mean it's not really worth defining like that?

I think this is an edge case we shouldn't worry about.

Perhaps famous last words.....

Yes, I just checked and I think you may be right. The WebIDL algorithm
to convert an ECMAScript array to an IDL value of type T[] iterates the
array and says:

While i < n:

Let x be the result of calling [[Get]] on V with property name ToString(i).
Set Ei to be the result of converting x to an IDL value of type T.

This step can throw (as part of the conversion process defined for converting to type T); seems like that would involve throwing from the whole algorithm.

-Boris


Reply via email to