Re: WebKit now supports CSS Variables

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?

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.

I'd prefer to throw away invalid declarations at parse time, and not
have to keep them around. Therefore, I suggest that we add text
similar to the @namespace specification:

  The namespace prefix is declared only within the style sheet in
  which its @namespace rule appears. It is not declared in any style
  sheets importing or imported by that style sheet, nor in any other
  style sheets applying to the document.


              Håkon Wium Lie                          CTO °þe®ª        

Received on Tuesday, 24 June 2008 11:51:06 UTC