W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2008

[whatwg] More Storage clarification

From: Brady Eidson <beidson@apple.com>
Date: Thu, 10 Apr 2008 16:37:05 -0700
Message-ID: <A26D19B7-4813-4F6A-B3CC-1E785A47A04E@apple.com>

On Apr 10, 2008, at 4:06 PM, Anne van Kesteren wrote:

> On Fri, 11 Apr 2008 01:01:46 +0200, Brady Eidson <beidson at apple.com>  
> wrote:
>> In 4.10.5, the description of the properties on the StorageEvent  
>> object mentions "...its newValue attribute set to the new value of  
>> the key in question, or null if the key was removed..."
>> So a web author can assume that when handling a StorageEvent whose  
>> newValue property is null that the event was the result of a  
>> removeItem(), and the key is no longer in the list.
>>
>> However in 4.10.2 in the discussion of setItem(), there is no  
>> mention that null is not an allowed value.  Something like  
>> sessionStorage.setItem("key", null) is not forbidden, therefore it  
>> is allowed, and it would result in a StorageEvent with a null  
>> newValue.
>>
>> To resolve this case, I propose that we specify that the value in a  
>> key/value pair cannot be set to null.
>> I see two clean ways to specify this:
>>
>> 1 - Throw an exception when setItem() is called with a null value.
>> 2 - Specify setItem(key, null) to have the exact same effects as  
>> removeItem(key).
>>
>> I prefer #2.  Thoughts?
>
> Euhm, setItem() takes two strings. Therefore I'd expect null,  
> undefined, etc. to be stringified.

Ugh... yup.  You're right.

Nevermind!

~Brady

>
>
>
> -- 
> Anne van Kesteren
> <http://annevankesteren.nl/>
> <http://www.opera.com/>
Received on Thursday, 10 April 2008 16:37:05 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:40 UTC