W3C home > Mailing lists > Public > www-style@w3.org > February 2011

Re: CSS Variables

From: L. David Baron <dbaron@dbaron.org>
Date: Mon, 7 Feb 2011 13:35:11 -0800
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style list <www-style@w3.org>
Message-ID: <20110207213511.GA7743@pickering.dbaron.org>
On Saturday 2011-02-05 16:34 -0800, Tab Atkins Jr. wrote:
> The syntax isn't complex.  What we're going with so far is this:
> 
> @var $foo red;
> bar {
>   color: $foo;
> }
> 
> The @var rule declares a single variable, taking a name and then
> arbitrary CSS as a value.  The var name must start with a $ character,
> so we can use $ as an unambiguous indicator in the content that a
> variable is being used.

What does "arbitrary CSS" mean?  Is it a character stream?  A token
stream?  A valid value?  A valid part of a value?  (Failing to
answer this question clearly before implementing may lead to a spec
that depends on the details of a particular implementation.  The
answer to this question also has *significant* effects on how hard
this proposal is to implement, but those answers may be different
for different implementations.)

Or, to put it more concretely, which of the following lines are valid:

  @var $a x;             p { width: 20p$a; }
  @var $b Roman";        p { font-family: "Times New $b; }
  @var $c 2px;           p { text-shadow: green $c $c; }
  @var $d green 2px 2px; p { text-shadow $d; }
  @var $e green 2px 2px; p { text-shadow $e, $e; }
  @var $f green 2px 2px; p { text-shadow $f 3px; }
  @var $g 2px, green;    p { text-shadow: blue 2px $g 1px 1px; }

(Note that line (b) is not compatible with the forwards-compatible
parsing rules.)


My expectation, for the record, would be that the answer is "token
stream", which would make lines (c) through (g) valid, but (a) and
(b) invalid.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Monday, 7 February 2011 21:35:43 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:37 GMT