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