- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 30 Nov 2012 16:31:12 -0500
- To: whatwg@lists.whatwg.org
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 actually
change the value of cards[i].dataset, right?
Given that, would it make more sense to just have a setFrom method on
dataset that takes a string? I guess the problem with that is name
collisions with data items...
Really, what we want to be able to do here is assign a string to
.dataset and have it do the right thing... WebIDL doesn't really
support that very well; perhaps it should.
> Another potentially interesting use-case for this is making it
> possible to "transfer" data-* attributes from one element to another
> with a simple "el1.dataset = el2.dataset;" statement.
Again, this would copy, not share, yes?
-Boris
Received on Friday, 30 November 2012 23:55:16 UTC