Re: [Css Variables] Variable Declaration Blocks

On Sep 26, 2008, at 5:46 AM, Mike Wilson wrote:

> Brad Kemper wrote:
>> But if the author wanted it to act as a constant,
>> where "first rule overrides later rules", he
>> could add a keyword to that rule that would
>> accomplish that by adding 1,000,000 to the
>> specificity calculation:
>
> 	@define constant {
> 	 mySimpleVariable: 5px;
> 	 myComplexVariable {
> 	     width: 5em;
> 	     height: 5em;
> 	 }
> 	}
>
> But how would you treat a subsequent
>  @define constant mySimpleVariable
> assignment in the same document?
>
> This is where Andrew wants the first clause to have
> precedence and this means we either have to invent a
> position-dependent specificity calculation or change
> the cascade algorithm.

In my view, if you added the keyword "constant" to the variable  
definition, then it would act more like a constant, with the first one  
taking precedence, and subsequent imported ones useful as default  
values in case the first one is missing. As Andrew described. I don't  
see any reason to fight against this; you can have your cake and eat  
it too.


> We already have !important for explicitly pointing
> out a certain rule to have precedence.

Not the same thing. If you have two rules in which !important is  
applied to the same value with the same specificity, then the second  
one wins. Which is opposite of how constants work. The whole idea  
behind constants is that they are like variables that don't change  
once declared. That is a useful thing to have.

Received on Friday, 26 September 2008 16:03:28 UTC