W3C home > Mailing lists > Public > public-webapi@w3.org > May 2008

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

From: Maciej Stachowiak <mjs@apple.com>
Date: Fri, 2 May 2008 19:50:50 -0700
Cc: Lachlan Hunt <lachlan.hunt@lachy.id.au>, "Web APIs WG (public)" <public-webapi@w3.org>
Message-Id: <9B4B21EF-F566-4AE6-B8E2-3D392237384D@apple.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>


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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 3 May 2008 02:51:36 GMT