- From: Scott Wilson <scott.bradley.wilson@gmail.com>
- Date: Thu, 20 Aug 2009 12:59:29 +0100
- To: marcosc@opera.com
- Cc: public-webapps WG <public-webapps@w3.org>
- Message-Id: <5AB0C2FD-FB97-48AA-BB70-1005FA37A142@gmail.com>
The question is important as it affects conformance. Currently we only support the first of the three methods you've stated, and there was discussion on the list previously as to whether the second of the three was even possible in a pure JavaScript implementation (search for "syntactic sugar"). What is the actual conformance requirement? S On 20 Aug 2009, at 11:49, Marcos Caceres wrote: > On Thu, Aug 20, 2009 at 11:46 AM, Scott > Wilson<scott.bradley.wilson@gmail.com> wrote: >> The Storage [1 interface ] is defined as: >> >> interface Storage { >> readonly attribute unsigned long length; >> getter any key(in unsigned long index); >> getter any getItem(in DOMString key); >> setter creator void setItem(in DOMString key, in any data); >> deleter void removeItem(in DOMString key); >> void clear(); >> }; >> >> I don't see any mention of accessing Storage as an array in either >> WebStorage or Widgets A&E. >> S >> > > Storage is just a javascript object, so it's properties can be > accessed any multiple ways: > > preferences.getItem(theNameOfTheKey); > preferences.theNameOfTheKey > preferences[preferences[0]] > > This makes the object that implements the interface tremendously > powerful and flexible. However, I agree that WebStorage should make > this more clear; but that should probably go into a primer, not in the > spec. > > Try it out in Firefox's address bar: > javascript: localStorage.setItem("test", "test123"); > javascript: alert(localStorage[localStorage[0]]) > javascript: alert(localStorage.test) > > The above will alert you "test123" > > -- > Marcos Caceres > http://datadriven.com.au
Attachments
- application/pkcs7-signature attachment: smime.p7s
Received on Thursday, 20 August 2009 12:00:21 UTC