[whatwg] DOM Storage feedback

On Tue, Jan 13, 2009 at 1:41 AM, Ian Hickson <ian at hixie.ch> wrote:
> On Mon, 28 Apr 2008, Brady Eidson wrote:
>>
>> Anne was asserting that since the interface for setItem() specifies a
>> DOMString as the input, anything you pass it will be stringified.
>> Therefore passing it the null value would be stringified to "null".
>> This is what you currently see in all the major browsers with
>> window.alert(null), for example, which is also specified as a DOMString
>> input parameter.
>>
>> Therefore a call to setItem("foo", null); becomes, in effect,
>> setItem("foo", "null");
>>
>> Is this correct?
>>
>> If so, the spec is fine as-is, and removeItem() is the only way to
>> remove an individual item.
>
> That is correct, at least currently. I am tempted to change this to
> [Null=Empty], though (i.e. make 'null' act like the empty string).
> However, I'm somewhat stuck on this as it depends on what happens with
> [Null] in WebIDL.

I talked with Cameron a while ago about what the default behavior
should be for null. We couldn't find any functions that required that
null be treated as "null", but there are several examples of functions
that require that null be treated as the empty string.

So from a code purity point of view it would be nicer if we could make
the default behavior be that null is treated as "null" as that would
require fewer exceptions.

The downside is that it would be a bigger change for more UAs than
going the other way around. So there's more risk of compat problems.

/ Jonas

Received on Tuesday, 13 January 2009 04:44:22 UTC