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

Re: [css-om][css-variables] exposing variables through CSSStyleDeclaration

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 27 Aug 2013 18:30:17 -0700
Message-ID: <CAAWBYDDRPwF8aCELCQJqjenLZ5xDRY4QwC08=ExFMxyJi6=hDA@mail.gmail.com>
To: Cameron McCormack <cam@mcc.id.au>
Cc: www-style list <www-style@w3.org>
On Tue, Aug 27, 2013 at 4:50 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> (Bringing this up to a top-level thread.)
>
> What's the reasoning behind not exposing variables (with their custom
> property names) through the CSSStyleDeclaration's operations and attributes?
> I think they should be.
>
>   p { var-a: 1 !important; }
>
>   decl.cssText;                       // ~"var-a: 1 !important;"
>   decl.length;                        // 1
>   decl[0];                            // "var-a"
>   decl.getPropertyValue("var-a");     // " 1 "
>   decl.getPropertyPriority("var-a");  // "important"
>   decl.setProperty("var-a", "2");     // changes the variable value
>   decl.removeProperty("var-a");       // removes the variable
>
> Without this, there's no way to get at the priority of a custom property
> declaration.

They are exposed as such.  Note that the CSSVariablesMap interface
operations all indirect through getProperty/setProperty.

The only thing that variables don't do is show up as named properties
on the interface.

~TJ
Received on Wednesday, 28 August 2013 01:31:06 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:31 UTC