Re: [webidl] Add a [Maplike] tag?

On Thu, Jun 27, 2013 at 3:08 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 6/27/13 2:24 PM, Tab Atkins Jr. wrote:
>>
>> One thing that seems to be lacking is a way to set a [MapClass]
>> attribute with an existing Map.  Right now I'd have to do:
>>
>> el.style.var.clear();
>> m.forEach(function(v,k) { el.style.var.set(k,v); });
>
> How would one copy one Map into another in ES?  Presumably whatever the
> idiom is for that is how this should work...

Using the constructor:

var m2 = new Map(m1);

However, adding a constructor to CSSVariablesMap is somewhat
complicated.  You'd have to provide an associated style rule, and we'd
have to keep all the associated CSSVariablesMap objects up-to-date
live, as opposed to now when there's only a single dedicated one.  I
presume that makes it easier.

~TJ

Received on Thursday, 27 June 2013 22:14:03 UTC