Re: [css3] Specificity mechanism issue

Warming up an old thread [1].

In CSS 1, the selector “a b c d e f g h i j” has the specificity 10,
same as “.a” [2].

In CSS 2, the selector “a b c d e f g h i j” has the specificity 10,
same as “.a” [3].

In CSS 2.1, the selector “a b c d e f g h i j” has the specificity
0,0,0,10, less specific than “.a” which has 0,0,1,0 [4].

In CSS 3, the selector “a b c d e f g h i j” has the specificity 10,
same as “.a” [5].

(I don’t understand that when the specs are talking about
concatenation, there would be a difference between “a b c d e f g h i
j”’s 10 and “.a”’s 10. Please correct me if I’m wrong, and if I am,
let’s maybe make things more clear in the specs.)

Yet, why is this?

While I don’t recall ever having seen any issues in practice—certainly
due to low probability of such long selectors—, CSS 2.1’s approach
makes much more sense to me. In other words, I’d yet have to see a
reason why 99 elements selectors would be less specific than an ID
selector, but 101 are.

Please let me know if I overlooked something.


[1] http://lists.w3.org/Archives/Public/www-style/2004Sep/0055.html
[2] http://www.w3.org/TR/CSS1/#cascading-order
[3] http://www.w3.org/TR/2008/REC-CSS2-20080411/cascade.html#specificity
[4] http://www.w3.org/TR/CSS21/cascade.html#specificity
[5] http://www.w3.org/TR/css3-selectors/#specificity

-- 
Jens O. Meiert
http://meiert.com/en/

Received on Wednesday, 31 March 2010 01:29:25 UTC