W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: More questions about contextual reference nodes

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 12 Apr 2011 21:15:59 -0700
Message-ID: <4DA5237F.3050902@mit.edu>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: public-webapps <public-webapps@w3.org>, Cameron McCormack <cam@mcc.id.au>
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
Received on Wednesday, 13 April 2011 04:16:38 GMT

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