Re: WebKit now supports CSS Variables

On Jun 24, 2008, at 6:49 AM, Håkon Wium Lie wrote:

> Also sprach David Hyatt:
> Variables in CSS has often been requested by authors and perhaps it's
> time to add this to the language. There are are concerns, however,
> about the scope of the variables. The current proposal says:
>  The definition of variables crosses @import boundaries.
> If they cross @import boundaries, why should they not cross from one
> linked style sheet to another?

They do.  Any variable is globally defined and usable by any  
stylesheets in the document (the way I implemented it at least).

> Still, it may be simpler and better not to allow any such crossing.
> Take for instance this example:
>  style sheet 1: @variable { X: 10px }
>  style sheet 2: @variable { X: none }
>  style sheet 3: div { width: var(X) }
> Style sheet numbering is in document order. If the
> fininshed-loading-order is: 3, 1, 2, the width declaration would first
> be invalid ("The declaration becomes invalid if the variable does not
> exist") then valid with 10px, and then invalid again when X is none.

In WebKit at least, the parsing of the declaration with the variable  
call is delayed until all stylesheets have been loaded (we don't show  
any content in WebKit while stylesheets are still loading).


Received on Tuesday, 24 June 2008 17:41:20 UTC