W3C home > Mailing lists > Public > www-style@w3.org > April 1996

RE: 'legal' / 'important' and cascading order

From: Chris Wilson (PSD) <cwilso@microsoft.com>
Date: Thu, 25 Apr 1996 09:16:00 -0700
Message-Id: <c=US%a=_%p=msft%l=RED-76-MSG-960425161600Z-31686@tide19.microsoft.com>
To: "'rieger@bse.de'" <rieger@bse.de>, "'preece@predator.urbana.mcd.mot.com'" <preece@predator.urbana.mcd.mot.com>
Cc: "'Bert.Bos@sophia.inria.fr'" <Bert.Bos@sophia.inria.fr>, "'www-style@w3.org'" <www-style@w3.org>
Scott Preece wrote:
>Perhaps I'm missing something - why can't you do the same thing in
>either case?  That is, if you have weights on individual properties
>within a rule, you can split the rule into multiple rules, one
>containing the
>unweighted properties and one containing the rules with a given weight.
>The separated rules could then be treated as you suggest.

You definitely can do this - in fact, it is probably the easiest and
best way to implement per-rule weighting.
>Frankly, it seems to me we should allow the weight to be put in both
>places, which gives the author maximum flexibility at the cost of a
>small additional amount of work in parsing.  That's why we build tools
>to make life easier for tool users.

Unfortunately, it's not just a small additional  amount of work in
parsing - it can make the cascade considerably less efficient.  Consider

H1 {
	font-size: 12pt;
	font-weight: bold !important;
	text-align: left;
	text-decoration: underline !important;
	font-family: Arial

This will get split into five declarations, unless you do some resolving
of rules with identical selectors, or keep up to three copies of a
grouping at the same time during parsing (for important, legal and
normal), either of which is not necessarily just a small amount of work.
 It also confuses the issue of parsing even a bit more to have the
"!important" token at the end of the value - it would have been much
easier to parse had these attributes been set at the beginning of each
declaration, e.g.
	!important font-weight: bold;

However, I personally am intensely in favor of per-group-only
declarations, e.g. (for the style above):
H1 !important {
	font-weight: bold;
	text-decoration: underline	}
H1 {
	font-size: 12pt;
	text-align: left;
	font-family: Arial	}

One of the goals of CSS is, I believe, to keep the cost of an initial
implementation low; I think it's wasteful to add this very small
convenience that probably won't be used much anyway, when the
implementation cost is non-trivial.

Chris Wilson
Received on Thursday, 25 April 1996 12:15:08 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:39 UTC