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

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

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 28 Aug 2013 09:50:37 +1000
Message-ID: <521D3B4D.9050107@mcc.id.au>
To: www-style list <www-style@w3.org>
(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.
Received on Tuesday, 27 August 2013 23:51:11 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 27 August 2013 23:51:11 UTC