W3C home > Mailing lists > Public > www-style@w3.org > June 2008

Re: WebKit now supports CSS Variables

From: Brad Kemper <brkemper@comcast.net>
Date: Fri, 27 Jun 2008 08:05:52 -0700
Cc: Daniel Glazman <daniel.glazman@disruptive-innovations.com>, Håkon Wium Lie <howcome@opera.com>, www-style list <www-style@w3.org>
Message-Id: <189F818D-6DDD-4285-8023-BE9D404A2802@comcast.net>
To: Andrew Fedoniouk <news@terrainformatica.com>


On Jun 26, 2008, at 7:09 PM, Andrew Fedoniouk wrote:
> Consider the following:
>
> @variables
> {
>  ThemeColor: #fe8d12;
> }
>
> body
> {
>  color: var(ThemeColor);
> }
>
> div
> {
>  color: inherit;
> }
>
> Question: what would be the value of div::color?
> In other words: what value non-existent variable is being evaluated  
> to?
> Some sort of 'undefined'

My expectation would be that it would be exactly the same as if you  
wrote this:

body
{
  color: #fe8d12;
}

div
{
  color: inherit;
}

> One more question:
>
> @variables
> {
>  ThemeSomething: #fe8d12;
> }
>
> body
> {
>  background: var(ThemeSomething) green;
> }

My expectation would be that it would be exactly the same as if you  
wrote this:

body
{
  background: #fe8d12 green;
}

Would that not be the case?

> Question is: where var(ThemeSomething) will go?
> To background-image or to background-color?
> What will happen if variable will be changed from "#fe8d12"
> to, say, "url(yeek.png)" in runtime?

Then I would expect it to use the new variable as a background image.

Even with constants, wouldn't you have the same sort of problem, if  
you had something like this:

@const
{
  ThemeSomething: #fe8d12;
  ThemeOtherThing: url(yeek.png);
}

.myTheme1
{
  background: cons(ThemeSomething) green;
}

.myTheme2
{
  background: cons(ThemeOtherThing) green;
}

And then you used JavaScript to change classNames on an object from  
"myTheme1" to "myTheme2"? Or to change the value of the background of  
"myTheme1" from "ThemeSomething" to "ThemeOtherThing"?


>
>
> -- 
> Andrew Fedoniouk.
>
> http://terrainformatica.com
>
Received on Friday, 27 June 2008 15:08:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:07 GMT