[whatwg] WebIDL vs HTML5 storage changes

Ian Hickson ian at hixie.ch
Tue May 20 14:00:28 PDT 2008

On Mon, 19 May 2008, Maciej Stachowiak wrote:
> On May 19, 2008, at 4:54 PM, Robert O'Callahan wrote:
> > If "storage.keyName = 'value';" can create a new storage item 
> > (persistently), won't authors expect "delete storage.keyName;" to 
> > remove it (persistently), as a matter of consistency?
> > 
> > If overloading "delete" is too quirky or too hard to implement, then 
> > it seems none of the other shorthands should be allowed either.
> Many objects in the DOM implement custom name getters (for instance 
> NodeList) and a few even implement custom name setters 
> (CSSStyleDeclaration, at least the way it is done in WebKit) but no one 
> has clamored for a custom deleter or expected delete to work "as a 
> matter of consistency" or been confused that "style.opacity = 0" is 
> allowed but "delete style.opacity" is not. So I would say the available 
> evidence argues against your conclusions.

The difference is that "style.opacity = 0" doesn't remove "opacity" from 
the "style" object but "storage.removeItem('opacity')" _does_ remove 
"opacity" from the "storage" object.

Originally, I wanted Storage objects to be indistinguishable from Object 
objects in JS, and native hash or collection objects in other bindings. 
Conceptually, that's what these objects are -- native name/value pair 
collections that happen to be mapped to non-volatile storage (or somewhat- 
volatile storage, in the case of sessionStorage).

I'd also like the "delete" operator to work on DOMStringMap (for the 
dataset object -- calling 'delete' on that has the side-effect of removing 
the underlying attribute) and UndoManager (where the side-effect is to 
remove the entry and renumber the following entries, so maybe that's not 
such a good idea after all), for what it's worth. If we want to decide 
that we're not supporting this, we should decide that before 
implementations of those come about.

For DOMStringMap, my intention was to not provide methods at all, and only 
provide the JS-native mechanisms.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list