[Bug 12798] Default to [TreatNullAs=EmptyString]

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12798

--- Comment #14 from Cameron McCormack <cam@mcc.id.au> 2011-06-13 22:20:17 UTC ---
(In reply to comment #13)
> ToString is also specified as the default conversion algorithm for DOMString
> parameters in Web IDL 4.1.14

Not after the recent change that prompted Jonas to reopen this bug.
http://dev.w3.org/2006/webapi/WebIDL/#es-DOMString

I had written myself a note from a fair while ago to make this change, but I
didn't write down the arguments for doing so. :o

In trying to come up with arguments to support this post facto, I can't come up
with anything super strong.  We do of course have [TreatNullAs] to handle cases
where the default isn't compatible with content.

There are many operation/attributes in the HTML5 spec that take a string where
passing in null seems like it should do the same thing as the empty string. 
null to me seems more "do nothing-ish" than the string "null".  So for example
doing

  inputElement.value = null;

on the face of it looks much more like it would clear the value rather than set
it to the string "null".  OTOH this could encourage two different, valid ways
of getting the same behaviour, when perhaps we should just be encouraging
authors to use "".

The previous behaviour is easier to explain.  "When you pass a value to a
DOMString parameter, it's always converted to a string like String(value) or
value+''".

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Monday, 13 June 2011 22:20:21 UTC