On Tue, Oct 13, 2009 at 3:40 PM, Ian Hickson <i...@hixie.ch> wrote:

> On Tue, 13 Oct 2009, Brett Cannon wrote:
> > On Mon, Oct 12, 2009 at 19:07, Ian Hickson <i...@hixie.ch> wrote:
> > >
> > > I believe you can test if a key is in the storage area using:
> > >
> > >   if (key in storage) { ... }
> > >
> > > For example:
> > >
> > >   if ('document' in window.localStorage) { ... }
> >
> > I didn't find that in the spec anywhere. Is it somehow implicit and I
> > just missed it? Or will it be specified sometime in the future?
>
> It's the net effect of this line in the spec:
>
> # The names of the supported named properties on a Storage object are the
> # keys of each key/value pair currently present in the list associated
> # with the object.
>
> ...combined with the definitions in the WebIDL spec.
>

It seems odd that there wouldn't be a corresponding method on localStorage
given that the deleter, getter, and setter all have them.

Of course, adding a new keyword would break backwards compatibility.  (Yet
another shortcoming of local storage.)

Reply via email to