[whatwg] Make DOMStringMap constructable, and el.dataset writeable?
Tab Atkins Jr.
jackalmage at gmail.com
Fri Nov 30 16:04:55 PST 2012
On Fri, Nov 30, 2012 at 4:01 PM, Ian Hickson <ian at 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
object.
~TJ
More information about the whatwg
mailing list