W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2008

Re: [whatwg] WebIDL and HTML5

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 25 Aug 2008 18:07:52 -0700
Message-ID: <48B35768.7030407@sicking.cc>
To: Garrett Smith <dhtmlkitchen@gmail.com>
CC: Boris Zbarsky <bzbarsky@mit.edu>, Web Applications Working Group WG <public-webapps@w3.org>

Garrett Smith wrote:
>>> There are probably others but I can't think of them. I think the
>>> majority of the time that strings will want to go to ToString,
>>> booleans will want to go to ToBoolean.
>> That can be the default, perhaps.  But I suspect usually null should become
>> "", not "null".
> 
> Why?


Note that 'null' is generally a valid value for DOMString. This doesn't 
seem to be explicitly called out in the definition for DOMString. 
However there are lots of functions that takes a DOMString and describes 
what to do when the argument is null (as opposed to "null").

So for a function like

   bool doStuff(in DOMString arg);

if null is passed there should be no need to call .toString() or any 
other type of conversion is needed at all. However most functions in the 
DOM spec does not define behavior for the null value, so we have chosen 
to treat it as the the empty string as that seems like the most sensible 
behavior.

/ Jonas
Received on Tuesday, 26 August 2008 01:09:06 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:27 GMT