W3C home > Mailing lists > Public > www-style@w3.org > September 2004

[css3] Specificity mechanism issue

From: Jens Meiert <jens.meiert@erde3.com>
Date: Mon, 13 Sep 2004 19:44:16 +0200 (MEST)
To: "W3C CSS" <www-style@w3.org>
Message-ID: <10756.1095097456@www3.gmx.net>

Dear CSS WG,

I suspect the mechanism to calculate the specificity of a selector [1] to be
insufficiently documented or (more likely) to be wrong. The specificity
examples tell us

LI.red.level    /* a=0 b=2 c=1 -> specificity =  21 */
#x34y           /* a=1 b=0 c=0 -> specificity = 100 */

but assuming (this seems absolutely legitimate) the calculated values for
the specificity to be decimal, it turns out that the specificity mechanism
has been quietly changed since now the selector (though unlikely)

li.a1.a2....a99.a100   /* a=0 b=100 c=1 -> specificity = 101 */

has a higher specificity than

#x34y           /* a=1 b=0 c=0 -> specificity = 100 */

In CSS versions 1 to 2.1 [2], the former example has a specificity of
0,0,100,1 while the latter has a 0,1,0,0 specificity (which is higher, not
lower as illustrated).

"Changes from CSS2" [3] doesn't say anything about this more or less
important change, so I ask for clarification and/or correction of this

Thank you, best regards,
 Jens Meiert.

[1] http://www.w3.org/TR/css3-selectors/#specificity
[2] http://www.w3.org/TR/CSS21/cascade.html#specificity
[3] http://www.w3.org/TR/css3-selectors/#changesFromCSS2

Jens Meiert
Interface Architect (IxD)

Received on Monday, 13 September 2004 17:44:49 GMT

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