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

Re: [css-variables] computed value of variables with abutting tokens

From: Simon Pieters <simonp@opera.com>
Date: Tue, 27 Aug 2013 10:02:39 +0200
To: "www-style list" <www-style@w3.org>, "Cameron McCormack" <cam@mcc.id.au>
Message-ID: <op.w2gtypcoidj3kv@simons-macbook-pro.local>
On Tue, 27 Aug 2013 09:05:38 +0200, Cameron McCormack <cam@mcc.id.au>  
wrote:

> What should be alerted here?
>
>    <style>
>      :root {
>        var-a:a;
>        var-b:var(a)b;
>      }
>    </style>
>    <script>
>      var cs = getComputedStyle(document.documentElement, "");
>      alert(cs.getPropertyValue("var-b"));
>    </script>

null.

Variables don't get exposed by getPropertyValue. They have a decicated API.

http://dev.w3.org/csswg/css-variables/#the-cssstyledeclaration-interface

> I take it that the computed value of var-b is a stream of two ident  
> tokens, with no white space between.  Should this be represented by  
> "a/**/b"?
>
> In nearly all situations it won't matter if we treat the value of var-b  
> as having a white space token between the two idents.  But it could  
> certainly change the validity of a property, for example:
>
>    :root {
>      var-a:1px;
>      font-size: calc(1px +var(a));
>    }

-- 
Simon Pieters
Opera Software
Received on Tuesday, 27 August 2013 07:56:50 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 27 August 2013 07:56:50 UTC