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

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 02 May 2008 22:17:18 -0500
Message-ID: <481BD93E.8000301@mit.edu>
To: "Web APIs WG (public)" <public-webapi@w3.org>

Cameron McCormack wrote:
> I think of it more like that null is the actual namespace URI value, and
> that an empty string is the non-standard way of specifying it (rather
> than the other way around).  Which makes me think of this more as
> something the method should handle, rather than something the bindings
> worry about.

But the method signature in IDL is DOMString.  So by the time it sees the 
argument, it will be a DOMString.  The only question is which DOMString.

In Gecko, if you pass in "" it will see the string "".

If you pass in null, it will see a string that is equal to "" but has a "this is 
a null string" bit set.

Conceptually, the latter is more like a |char * str = NULL| and the former is 
more like a |char * str = "";| but both represented by a String object of some sort.

It might make sense to declare this the default conversion of null to DOMString 
and then have NoNull mean that the Object.prototype.toString conversion should 
be used instead.

-Boris


-Boris
Received on Saturday, 3 May 2008 03:17:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 3 May 2008 03:17:59 GMT