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

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