W3C home > Mailing lists > Public > www-style@w3.org > October 1999

Re: Cascade: Supplement instead of Overwrite

From: Sjoerd Visscher <sjoerd@heeten.nl>
Date: Sun, 10 Oct 1999 14:23:58 +0200
Message-ID: <003a01bf1323$c66d53e0$1400000a@beneden>
To: "www-style" <www-style@w3.org>
> Hmm. It looks nice, but I can see some problems:
>
>    This requires the redefinition of every property which is going to
>    support this. The other suggestions use a syntax independent of the
>    syntax of the property itself.
I didn't think of it as such. As I am a programmer, I see old-values() as a
function call, which is simply replaced with it's return value. Functions
are already mentioned in the CSS2 syntax, so when the return value is
defined in some general chapter of the CSS recommendation, it
is not required to redefine all properties. This is why I called it
'old-values()' instead of simply 'old-values'.

>    The other suggestions allow the implementation to immediately spot
>    which rules are going to use supplemental cascading, this requires
>    UAs to actually parse the content of the values before being able
>    to ascertain what is going on.
I don't see the difference between looking for ! or looking for (). Even
more, if an implementation follows the tokenization of CSS2, it has already
recognized old-values() as a function, while ! falls in the DELIM category,
just like f.e. the comma.

>    To actually implement this, UAs would have to traverse the matched
>    rules twice: backwards to find the first rule which didn't contain
>    old-values(), and then forwards to insert the old values. The other
>    suggestions only need a single traversal.
??? my suggestion does exactly the same as yours, it's just al little bit
more flexible. The difference is the name: you name it 'supplement', which
suggests a top-down traversal. I name it 'old-values()' which suggests a
bottom-up traversal.

I wonder why you have a top-down approach in mind. 'Cascading' more or less
implies a bottom-up approach. And I think that an implementation that
traverses the rules from low specificity to high specificity (bottom-up) is
faster than the other way around (top-down). A bottom-up approach starts to
assign the default values, then assigns the values of each rule (cascading).
A top-down approach first assigns the values of the most specific rule. Then
it assigns the values of the next rule, to all the properties that have no
value yet. Finally it must find all properties that have not been assigned
yet, and give them the default value. This leads to less value assignments,
but a lot more checking. And checking is way slower than assigning.
In a bottom-up approach the value of old-values() can be replaced with the
value that has been assigned by the less specific rules, which is a single
traversal.

There's another one thing I'd like to be able to do with multiple values. Is
this allowed:

BODY {font-family: Arial,Helvetica}
H1 {font-family: Comic Sans,inherit}

Sjoerd Visscher
Received on Sunday, 10 October 1999 09:34:30 GMT

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