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

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.

Bert wrote: "The rules in a STYLE attribute don't have selectors". This
is what I read in CR-CSS21-20070719, 6.4.3. But there exists a CSS file
with Bert as a co-editor: 
   WD-css-style-attr-20020515 . 
The grammar of that file runs:

inline-stylesheet
  : S* [ declarations | declarations-block | inline-ruleset* | stylesheet ]
  ;

inline-ruleset
  : [ pseudo* S* [ ',' S* pseudo* S* ]* ]?
    declarations-block
  ;

But 'stylesheet', the last alternative, contains 'ruleset'. And 'ruleset'
contains 'selector'.

This lack of precision is very time-consuming and very annoying. Instead of
demanding three different grammars, it would have been better to demand one
grammar only by demanding selectors in the style attribute.

With WD-css-style-attr-20020515, three grammars must be obeyed:

1. STYLE_BEGIN a { color: red } a:link { color: green } STYLE_END
2. A_BEGIN style="color:red" A_END
3. A_BEGIN style="{ color:red } :link{ color:green }" A_END

Although the following would have been possible:

1. STYLE_BEGIN a { color: red } a:link { color: green } STYLE_END
2: A_BEGIN style="a {color:red}" A_END
3: A_BEGIN style="a { color:red } a:link{ color:green }" A_END


winfried


Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT FÜR ALLE NEUEINSTEIGER
Jetzt bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket
für clevere Doppel-Sparer, nur  29,95 €  inkl. DSL- und ISDN-Grundgebühr!
http://www.arcor.de/rd/emf-dsl-2

Received on Wednesday, 12 December 2007 12:46:57 UTC