- From: Ian Hickson <ian@hixie.ch>
- Date: Sat, 1 Dec 2012 02:55:08 +0000 (UTC)
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: WHATWG List <whatwg@whatwg.org>
On Fri, 30 Nov 2012, Tab Atkins Jr. wrote: > On Fri, Nov 30, 2012 at 4:01 PM, Ian Hickson <ian@hixie.ch> wrote: > > On Fri, 30 Nov 2012, Tab Atkins Jr. wrote: > >> She's making a game, where the game initialization script expects > >> certain types of elements, and for the initial state data of the > >> elements to be present in data attributes on them. She'd like to be > >> able to pause the game, shifting all the state data into localStorage, > >> then later resume by pulling it back onto elements before starting the > >> game script. > > > > Presumably you wouldn't necessarily want to grab _all_ the data-* > > attributes, since some might be from other libraries, or temporary > > transitional values used for animations or tracking things like mouse > > position. > > Nah, that's fine. Might be non-optimal in some cases, but then you > can just pick them out individually. Well that's kind of my point. You can pick them out individually... how common is it going to be that you want all of them? > >> It would be somewhat cleaner if she could simply construct a > >> DOMStringMap and assign it > > > > I don't really understand what you would do with the DOMStringMap and > > localStorage. Can you elaborate? > > Sorry, when putting it in localStorage, you have to serialize it to > JSON. Then you want to revive it as a DOMStringMap initialized by an > object. If you're going to do all that work, why not just do it with the element? -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Saturday, 1 December 2012 03:48:13 UTC