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

Re: WebKit now supports CSS Variables

From: Håkon Wium Lie <howcome@opera.com>
Date: Tue, 24 Jun 2008 20:29:16 +0200
Message-ID: <18529.15612.300507.771492@opera.com>
To: David Hyatt <hyatt@apple.com>
Cc: www-style list <www-style@w3.org>

Also sprach David Hyatt:

 > > 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).

Ok, so you don't see the problem outlined above. Opera supports
progressive rendering of content as style sheets are loaded so for us
the problem is real. 

Progessive rendering of content is a long-established concept in CSS
and I don't think the benefit of variables outweight the cost of
breaking progressive rendering.

Style sheet reuse is another area that will suffer as a result of
allowing cross-stylesheet variables; style sheets will become more
interdependent and therefore harder to reuse. On a more practical
level, style sheet debugging will be harder as one has to search for
where global variables are set and changed.

Here's some reading on global variables:

  They are usually considered bad practice precisely because of their
  nonlocality: a global variable can potentially be modified from
  anywhere, and any part of the program may depend on it. A global
  variable therefore has an unlimited potential for creating mutual
  dependencies, and adding mutual dependencies increases complexity.

  http://en.wikipedia.org/wiki/Global_variable

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome
Received on Tuesday, 24 June 2008 18:30:03 GMT

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