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

Re: CSS21] CR-CSS21-20070719, 6.4.3 Selector specificity

From: Bert Bos <bert@w3.org>
Date: Tue, 18 Sep 2007 11:26:40 +0200
To: Andrei Polushin <polushin@gmail.com>
Cc: www-style@w3.org
Message-Id: <200709181126.40436.bert@w3.org>

On Monday 17 September 2007 23:15, Andrei Polushin wrote:
> Bert Bos wrote:
> > szukw000@arcor.de wrote:
> >> ---------------------------------------------
> >> CSS21 counts four values in Section 6.4.3:
> >>
> >> a: 'style' attribute
> >> b: ID attributes in the selector
> >> c: other attributes and pseudo-classes
> >> d: element names and pseudo-elements
> >> ---------------------------------------------
> >> CSS3 counts three values in Section 9:
> >>
> >> a: ID selectors
> >> b: class selectors, attributes selectors, pseudo-classes
> >> c. element
> >>
> >> ignore pseudo-elements
> >> ---------------------------------------------
> >>
> >> Q1: Is the computed specificity value of CSS21 incompatible with
> >> the computed specificity value of CSS3?
> >
> > They always give the same result in the cases that the Selectors
> > module deals with, i.e., rules that have selectors.
>
> CSS21 counts for pseudo-elements, but CSS3 specifies "ignore
> pseudo-elements". Is it the incompatible difference?

It doesn't matter whether you count them or not. Both CSS 2.1 section 
5.2[1] and Selectors section 4[2] say that there may be no more than 
*one* pseudo-element at the end of the selector. E.g., if you have 
three selectors

    :first-line
    p:first-line
    body p:first-line

you can assign them specificities 0, 1 and 2 (per Selectors) or 1, 2 and 
3 (per CSS 2.1), but the result is always that the last one has the 
highest specificity.

[1] 
http://www.w3.org/TR/2007/CR-CSS21-20070719/selector.html#selector-syntax
[2] 
http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#selector-syntax



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Tuesday, 18 September 2007 09:26:50 GMT

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