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

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

From: fantasai <fantasai.lists@inkedblade.net>
Date: Thu, 16 Oct 2008 06:25:45 -0700
Message-ID: <48F740D9.1000200@inkedblade.net>
To: szukw000@arcor.de
CC: www-style@w3.org

szukw000@arcor.de wrote:
> On Tuesday 04 September 2007, 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?
> 
> Bert Bos and Ian Hickson both answered that it does not matter whether
> pseudo-elements are counted or not.
> 
> I have checked today  (Dec 12th 2007) whether the CSS3 module 
>     WD-css3-selectors-20051215
> has been changed. It has not. So I propose the following change for
> Section 9 of WD-css3-selectors-20051215:
> ----------------------------
> 9. Calculating a selector's specificity
> 
> A selector's specificity is calculated as follows:
> 
>  o count the number of ID selectors in the selector (= a)
>  o count the number of class selectors, attributes selectors, and
>    pseudo-classes in the selector (= b)
>  o count the number of element names, and pseudo-elements in the
>    selector (= c)
> ----------------------------
> Now the semantic of the text in CSS3 is the same as in CSS21. 
> Implementors are free to count pseudo-elements or not. But readers
> of the specification are no longer puzzled.

Fixed. The new text reads

     * count the number of ID selectors in the selector (= a)
     * count the number of class selectors, attributes selectors,
       and pseudo-classes in the selector (= b)
     * count the number of type selectors and pseudo-elements in
       the selector (= c)
     * ignore the universal selector

where the last two are changed.

~fantasai
Received on Thursday, 16 October 2008 13:26:30 GMT

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