W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2012

Re: [whatwg] Make DOMStringMap constructable, and el.dataset writeable?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 30 Nov 2012 16:04:55 -0800
Message-ID: <CAAWBYDDmcJgpQ2TwHNg7KDZZdR53UXBRGybB3xzB3tcjBSRjQw@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: WHATWG List <whatwg@whatwg.org>
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.

>> 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

Received on Saturday, 1 December 2012 02:34:21 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:50 UTC