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

Re: [whatwg] WebIDL and HTML5

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 26 Aug 2008 08:38:05 -0400
Message-ID: <48B3F92D.7070401@mit.edu>
To: Garrett Smith <dhtmlkitchen@gmail.com>
CC: Web Applications Working Group WG <public-webapps@w3.org>

Garrett Smith wrote:
> There is no DOM method calld doStuff. Can you provide a concrete
> example? Boris couldn't think of one either.

Uh, what?  You never said, "I don't understand that this applies to all 
DOM methods that take a DOMString, so I'd like to have some specific 
examples."

In any case, here's a simple example:

javascript:try { alert(document.createElement(null).localName); } 
catch(e) { alert(e) }

In some UAs that alerts "null", in some it throws an exception because 
createElement("") is not valid.  Just try it.

> No, but there should be a need to call ToString.

The thing is, ToString is lossy.  Once called, there is no way to tell 
apart "null" and null.  However, there are DOM methods which require 
different behavior for the two (e.g. createElementNS and so forth, which 
I did explicitly mention earlier, contrary to your "counldn't think of 
one either" business).

Similarly, there are DOM methods that require different behavior for 
null and "".  Specific examples include the proposed DOM style set APIs, 
DOMImplementation.createDocument. There are also cases where returning 
null and returning "" are not equivalent.  inputEncoding is an example.

> It is not something that can or should be generally relied upon
> because it is not standardized and indeed works differently in
> implementations.

Yes.  The whole point is to standardize it.

> Considering your argument for serializing null -> "" being the most
> "sensible", I disagree.

It's sensible in the context of the large number of DOM methods that 
treat the two as equivalent (again, all the *NS methods in DOM3 Core).

-Boris
Received on Tuesday, 26 August 2008 12:38:51 GMT

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