- From: Jeremy Orlow <jorlow@chromium.org>
- Date: Tue, 13 Oct 2009 15:53:14 -0700
On Tue, Oct 13, 2009 at 3:40 PM, Ian Hickson <ian at hixie.ch> wrote: > On Tue, 13 Oct 2009, Brett Cannon wrote: > > On Mon, Oct 12, 2009 at 19:07, Ian Hickson <ian at 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.) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20091013/e078957c/attachment.htm>
Received on Tuesday, 13 October 2009 15:53:14 UTC