Re: [css-variables] Using $foo as the syntax for variables

On Wed, 23 May 2012 19:32:50 +0200, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:

> In the new syntax, it would look something like this:
> color: $bar //normal
> color: default-var($bar, red) // default value
> color: parent-var($bar) // bar from the parent
> color: parent-var($bar, red) // bar from the parent, with a default value

If we go with $ (which I still think we shouldn't), I think the above  
should
be written like this instead:

color: $bar //normal
color: default-var(bar, red) // default value
color: parent-var(bar) // bar from the parent
color: parent-var(bar, red) // bar from the parent, with a default value

Keeping the $ within the function, seems to imply that you want to expand
the variable first, and then apply the function, giving the following
behavior:

ul {
   $foo: red;
   $bar: green;
}
li {
   $foo: bar;
   $bar: blue;
   $background-color: parent-var($foo); /* you get green */
}

Also, having the following two be equivalent
  color: $bar;
  color: var(bar);
Makes it possible to have multiple levels of indirection. Which you can't
have with $, unless you want to allow this:
  color: $$bar;

  - Florian

Received on Thursday, 24 May 2012 07:30:30 UTC