W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 27 Jun 2013 15:13:17 -0700
Message-ID: <CAAWBYDBTZW3Fvxk_dtSnhibi=Q8LG1d2t2USjN7NGdpio_dokA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
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.

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:13 UTC