Re: More questions about contextual reference nodes

On 2011-04-13 06:32, Cameron McCormack wrote:
> Lachlan Hunt:
>>> OK. Then I'm not sure what the practical difference between the
>>> Element[] or sequence<Element>  would be then, nor which one to use.
>
> ... the only difference is that with Element[] you can distinguish
> between null and an array of [length 0], while with sequence<Element>  you
> can’t.

I don't think it's necessary to distinguish between null and length 0 
here, since they both mean that there are no contextual reference elements.

However, with the way in which the IDL is overloaded, it's not clear to 
me which of the two overloaded methods gets invoked when the parameter 
is null.

The IDL says:
   querySelector(in DOMString selectors, in optional Element refElement);
   querySelector(in DOMString selectors, in sequence<Node> refNodes);

When the author invokes:

   x.querySelector("a", null);

Does it invoke the method with refElement or refNodes?

(Although, in this case, it shouldn't matter, since the algorithm I 
wrote to determine contextual reference nodes ignores null in either case)

>>> 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.
>
> Yep.

Which conversion algorithm applies here?  Is it 4.1.15. object, or 
4.1.16. Interface types?

http://dev.w3.org/2006/webapi/WebIDL/#es-object

The former never throws, the latter will throw a TypeError. So am I 
right in assuming it's the latter?

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Wednesday, 13 April 2011 10:20:46 UTC