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

2012-11-30 Thread Tab Atkins Jr.
Currently, el.dataset is readonly. A friend of mine passed along a use-case for making it writeable. 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

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

2012-11-30 Thread Anne van Kesteren
On Fri, Nov 30, 2012 at 8:23 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: Thoughts? URLQuery uses this model. But I reckon that for DOMStringMap it is a bit trickier since it is actually mostly about manipulating DOM attributes through a simpler interface. It's not a map that is serialized to

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

2012-11-30 Thread Boris Zbarsky
On 11/30/12 2:23 PM, Tab Atkins Jr. wrote: It would be somewhat cleaner if she could simply construct a DOMStringMap and assign it, like so: for(var i = 0; i cards.length; i++) { cards[i].dataset = new DOMStringMap(carddata[i]); So this would copy the DOMStringMap into the dataset, not

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

2012-11-30 Thread Boris Zbarsky
On 11/30/12 7:07 PM, Tab Atkins Jr. wrote: Sure. I presume you're afraid of multiple elements sharing the same object? We can call it afraid or we can call it nonsensical since the object is just syntactic sugar on top of the (not shared) attributes the objects have ;) Really, what

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

2012-11-30 Thread Ian Hickson
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

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

2012-11-30 Thread Tab Atkins Jr.
On Fri, Nov 30, 2012 at 4:01 PM, Ian Hickson i...@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.

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

2012-11-30 Thread Tab Atkins Jr.
On Fri, Nov 30, 2012 at 1:31 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 11/30/12 2:23 PM, Tab Atkins Jr. wrote: It would be somewhat cleaner if she could simply construct a DOMStringMap and assign it, like so: for(var i = 0; i cards.length; i++) { cards[i].dataset = new

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

2012-11-30 Thread Ian Hickson
On Fri, 30 Nov 2012, Tab Atkins Jr. wrote: On Fri, Nov 30, 2012 at 4:01 PM, Ian Hickson i...@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