Re: [selectors-api] Extended Attribute [NoNull] in the IDL

On May 2, 2008, at 7:23 PM, Boris Zbarsky wrote:

>
> Lachlan Hunt wrote:
>>>>> What do they do if there is an element named <null> in the  
>>>>> document?
>>>>
>>>> IE 8 Beta: Returns null or empty NodeList
>>>
>>> Interesting.   What happens in IE8b1 if you do:
>>>
>>>  document.querySelector("")
>> Throws a SYNTAX_ERR.
>
> In that case, the null behavior doesn't make any sense to me...  I  
> would expect querySelector(null) to either behave as  
> querySelector("null") (as in Opera) or as querySelector("") (as in  
> Gecko and apparently Webkit)...
>
> Sounds like whatever gets specified here we need a test for it in  
> the test suite, at least.

I'm not sure what NoNull is supposed to mean, but existing DOM APIs  
that take strings almost always either treat JS null the same as "",  
or the same as "null". I think Web IDL should define a property to  
distinguish these cases. In WebKit's IDL we have the overly verbose  
[ConvertNullToNullString] extended attribute for the first case (we  
internally distinguish null string from empty string and I think there  
may be a tiny number of APIs that actually treat null and empty  
differently). I am not sure which of these behaviors [NoNull] applies  
to.

We have similar extended attributes for IDL method return values or  
attributes that are nominally DOMString but may return other values  
such as null, or occasionally undefined, or in at least one crazy  
case, boolean false (thanks to whoever designed queryCommandValue).

Regards,
Maciej

Received on Saturday, 3 May 2008 02:51:35 UTC