Re: WebKit now supports CSS Variables

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 UTC