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

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

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Fri, 02 May 2008 22:17:14 +0200
Message-ID: <481B76CA.6080304@lachy.id.au>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: "Web APIs WG (public)" <public-webapi@w3.org>

Boris Zbarsky wrote:
> 
> Lachlan Hunt wrote:
>> That's in the Bindings4Dom spec.  I'm trying to make the IDL conform 
>> to it.
>>
>> http://dev.w3.org/2006/webapi/Binding4DOM/#NoNull
> 
> So the relevant part of that spec is:
> 
>   How implementations treat the assignment of a null  value to an
>   attribute with the [NoNull]  extended attribute, or passing a null
>   value as a [NoNull] operation argument, is specific to the language
>   binding.
> 
> The example indicates that in ECMAScript passing null as a DOMString 
> just passes the string "null".  What is the benefit of this behavior 
> over treating null as the empty string, which is what I presume happens 
> if the [NoNull] is not specified?
> 
> What do existing implementations do here?

Tested using this code:

try {
   var x = document.querySelector(null);
   alert("x = " + x);
} catch(e) {
   alert(e);
}

and similarly for querySelectorAll(null);

WebKit:    Throws SYNTAX_ERR for both
IE 8 Beta: Returns null or empty NodeList
Opera:     Returns null or empty NodeList

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Friday, 2 May 2008 20:17:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 2 May 2008 20:17:50 GMT