W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: [css-variables] CSSVariablesMap enumeration

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 20 Jun 2013 10:41:56 -0700
Message-ID: <CAAWBYDDQ_voxrj5KXRgVFQ9T_MPy8Jm5Sfhv==k5b7rSo2WnUQ@mail.gmail.com>
To: Alan Cutter <alancutter@chromium.org>
Cc: www-style list <www-style@w3.org>
On Thu, Jun 20, 2013 at 2:24 AM, Alan Cutter <alancutter@chromium.org> wrote:
> Hello,
> I've taken over the CSS Variables implementation in Blink. I have some
> concerns/questions regarding iterating over a CSSVariablesMap object.
> At the moment enumeration over a CSSVariablesMap is only indicated in an
> example.
> var customProps = el.style.var;
> for(customPropName in customProps) {
>   if( knownCustomPropName(customPropName) ) {
>     var customPropValue = customProps[customPropName];
>     /* Processing code here. */
>   }
> }
> It is hard to find a concrete specification that it has this behaviour.
> Previously enumeration was implied by the presence of a getter interface
> method. Is enumeration inherited as part of the MapClass interface?

Apologies, the example is out of date.  I'm using some experimental
WebIDL (hasn't made it into the spec quite yet - Cameron should have
it in there this week or the next), so it should be a straight JS Map
object, and have the iteration behavior described in JS.  (That is, it
should have .keys(), .values(), and .items(), which return Arrays with
the corresponding data.  When we get for-of loops, it'll automatically
iterate with whichever one is default for Maps, which I think is

Because of this, there is no longer a getter/setter interface at all.
That kind of generic "every property is valid" interface is
discouraged by TC39, because it produces weird situations (setting a
property on the prototype makes it look like it's a variable, but it's

I'll fix the examples to work with my current WebIDL.

Received on Thursday, 20 June 2013 17:42:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:31 UTC