1515
1616 < h1 id =title > Selectors Level 4</ h1 >
1717
18- < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 16 September
18+ < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 20 September
1919 2011</ h2 >
2020
2121 < dl >
2222 < dt > This version:
2323
24- < dd > <!-- <a href="http://www.w3.org/TR/2011/ED-selectors4-20110916 /">
25- http://www.w3.org/TR/2011/WD-selectors4-20110916 </a> -->
24+ < dd > <!-- <a href="http://www.w3.org/TR/2011/ED-selectors4-20110920 /">
25+ http://www.w3.org/TR/2011/WD-selectors4-20110920 </a> -->
2626 < a href ="http://dev.w3.org/csswg/selectors4 ">
2727 http://dev.w3.org/csswg/selectors4</ a >
2828
@@ -407,40 +407,43 @@ <h2 class="no-num no-toc" id=contents>Table of Contents</h2>
407407 Reference combinators</ a >
408408 </ ul >
409409
410- < li > < a href ="#formal-syntax "> < span class =secno > 15. </ span > Formal
410+ < li > < a href ="#specificity "> < span class =secno > 15. </ span > Calculating a
411+ selector's specificity</ a >
412+
413+ < li > < a href ="#formal-syntax "> < span class =secno > 16. </ span > Formal
411414 Syntax</ a >
412415 < ul class =toc >
413- < li > < a href ="#grammar "> < span class =secno > 15 .1. </ span > Grammar</ a >
416+ < li > < a href ="#grammar "> < span class =secno > 16 .1. </ span > Grammar</ a >
414417
415- < li > < a href ="#lex "> < span class =secno > 15 .2. </ span > Lexical scanner</ a >
418+ < li > < a href ="#lex "> < span class =secno > 16 .2. </ span > Lexical scanner</ a >
416419 </ ul >
417420
418- < li > < a href ="#profiling "> < span class =secno > 16 . </ span > Profiles</ a >
421+ < li > < a href ="#profiling "> < span class =secno > 17 . </ span > Profiles</ a >
419422
420- < li > < a href ="#conformance "> < span class =secno > 17 . </ span > Conformance</ a >
423+ < li > < a href ="#conformance "> < span class =secno > 18 . </ span > Conformance</ a >
421424 < ul class =toc >
422- < li > < a href ="#conventions "> < span class =secno > 17 .1. </ span > Document
425+ < li > < a href ="#conventions "> < span class =secno > 18 .1. </ span > Document
423426 Conventions</ a >
424427
425- < li > < a href ="#conformance-classes "> < span class =secno > 17 .2. </ span >
428+ < li > < a href ="#conformance-classes "> < span class =secno > 18 .2. </ span >
426429 Conformance Classes</ a >
427430
428- < li > < a href ="#partial "> < span class =secno > 17 .3. </ span > Partial
431+ < li > < a href ="#partial "> < span class =secno > 18 .3. </ span > Partial
429432 Implementations</ a >
430433
431- < li > < a href ="#experimental "> < span class =secno > 17 .4. </ span > Experimental
434+ < li > < a href ="#experimental "> < span class =secno > 18 .4. </ span > Experimental
432435 Implementations</ a >
433436 </ ul >
434437
435- < li > < a href ="#acknowledgements "> < span class =secno > 18 . </ span >
438+ < li > < a href ="#acknowledgements "> < span class =secno > 19 . </ span >
436439 Acknowledgements</ a >
437440
438- < li > < a href ="#references "> < span class =secno > 19 . </ span > References</ a >
441+ < li > < a href ="#references "> < span class =secno > 20 . </ span > References</ a >
439442 < ul class =toc >
440- < li > < a href ="#normative-references "> < span class =secno > 19 .1. </ span >
443+ < li > < a href ="#normative-references "> < span class =secno > 20 .1. </ span >
441444 Normative References</ a >
442445
443- < li > < a href ="#informative-references "> < span class =secno > 19 .2. </ span >
446+ < li > < a href ="#informative-references "> < span class =secno > 20 .2. </ span >
444447 Informative References</ a >
445448 </ ul >
446449 </ ul >
@@ -2988,9 +2991,27 @@ <h3 id=idref-combinator><span class=secno>14.5. </span> Reference
29882991
29892992 < p class =issue > This could also be implemented as a functional pseudo-class.
29902993
2991- < p > negation or < a href ="#matches "> matches</ a > pseudo-class is the
2992- specificity of its most specific argument. The pseudo-class itself does
2993- not count as pseudo-class.
2994+ < h2 id =specificity > < span class =secno > 15. </ span > Calculating a selector's
2995+ specificity</ h2 >
2996+
2997+ < p > A selector's specificity is calculated as follows:
2998+
2999+ < ul >
3000+ < li > count the number of ID selectors in the selector (= a)
3001+
3002+ < li > count the number of class selectors, attributes selectors, and
3003+ pseudo-classes in the selector (= b)
3004+
3005+ < li > count the number of type selectors and pseudo-elements in the selector
3006+ (= c)
3007+
3008+ < li > ignore the universal selector
3009+ </ ul >
3010+
3011+ < p > The specificity of a < a href ="#negation "> negation</ a > or < a
3012+ href ="#matches "> matches</ a > pseudo-class is the specificity of its most
3013+ specific argument. The pseudo-class itself does not count as pseudo-class.
3014+
29943015
29953016 < p class =issue > It would probably be better to have match-sensitive
29963017 specificity, if possible. See < a
@@ -3022,9 +3043,9 @@ <h3 id=idref-combinator><span class=secno>14.5. </span> Reference
30223043 specified in an HTML < code > style</ code > attribute is described in CSS 2.1.
30233044 < a href ="#CSS21 " rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a > .
30243045
3025- < h2 id =formal-syntax > < span class =secno > 15 . </ span > Formal Syntax</ h2 >
3046+ < h2 id =formal-syntax > < span class =secno > 16 . </ span > Formal Syntax</ h2 >
30263047
3027- < h3 id =grammar > < span class =secno > 15 .1. </ span > Grammar</ h3 >
3048+ < h3 id =grammar > < span class =secno > 16 .1. </ span > Grammar</ h3 >
30283049
30293050 < p > The grammar below defines the syntax of Selectors. It is globally LL(1)
30303051 and can be locally LL(2) (but note that most UAs should not use it
@@ -3123,7 +3144,7 @@ <h3 id=grammar><span class=secno>15.1. </span> Grammar</h3>
31233144 : type_selector | universal | HASH | class | attrib | pseudo
31243145 ;</ pre >
31253146
3126- < h3 id =lex > < span class =secno > 15 .2. </ span > Lexical scanner</ h3 >
3147+ < h3 id =lex > < span class =secno > 16 .2. </ span > Lexical scanner</ h3 >
31273148
31283149 < p > The following is the < a name =x3 > tokenizer</ a > , written in Flex (see < a
31293150 href ="#FLEX " rel =biblioentry > [FLEX]<!--{{!FLEX}}--> </ a > ) notation. The
@@ -3191,7 +3212,7 @@ <h3 id=lex><span class=secno>15.2. </span> Lexical scanner</h3>
31913212
31923213 . return *yytext;</ pre >
31933214
3194- < h2 id =profiling > < span class =secno > 16 . </ span > Profiles</ h2 >
3215+ < h2 id =profiling > < span class =secno > 17 . </ span > Profiles</ h2 >
31953216
31963217 < p > Each specification using Selectors must define the subset of Selectors
31973218 it allows and excludes, and describe the local meaning of all the
@@ -3352,9 +3373,9 @@ <h2 id=profiling><span class=secno>16. </span>Profiles</h2>
33523373 </ ol >
33533374 </ div >
33543375
3355- < h2 id =conformance > < span class =secno > 17 . </ span > Conformance</ h2 >
3376+ < h2 id =conformance > < span class =secno > 18 . </ span > Conformance</ h2 >
33563377
3357- < h3 id =conventions > < span class =secno > 17 .1. </ span > Document Conventions</ h3 >
3378+ < h3 id =conventions > < span class =secno > 18 .1. </ span > Document Conventions</ h3 >
33583379
33593380 < p > Conformance requirements are expressed with a combination of descriptive
33603381 assertions and RFC 2119 terminology. The key words “MUST”, “MUST
@@ -3381,7 +3402,7 @@ <h3 id=conventions><span class=secno>17.1. </span>Document Conventions</h3>
33813402
33823403 < p class =note > Note, this is an informative note.
33833404
3384- < h3 id =conformance-classes > < span class =secno > 17 .2. </ span > Conformance
3405+ < h3 id =conformance-classes > < span class =secno > 18 .2. </ span > Conformance
33853406 Classes</ h3 >
33863407
33873408 < p > Conformance to Selectors Level 4 is defined for three conformance
@@ -3427,14 +3448,14 @@ <h3 id=conformance-classes><span class=secno>17.2. </span> Conformance
34273448 selectors. (In the case of CSS, the entire rule in which the selector is
34283449 used is effectively dropped.)
34293450
3430- < h3 id =partial > < span class =secno > 17 .3. </ span > Partial Implementations</ h3 >
3451+ < h3 id =partial > < span class =secno > 18 .3. </ span > Partial Implementations</ h3 >
34313452
34323453 < p > So that authors can exploit the forward-compatible parsing rules to
34333454 assign fallback values, UAs < strong > must</ strong > treat as < a
34343455 href ="#invalid "> invalid</ a > any selectors for which they have no usable
34353456 level of support.
34363457
3437- < h3 id =experimental > < span class =secno > 17 .4. </ span > Experimental
3458+ < h3 id =experimental > < span class =secno > 18 .4. </ span > Experimental
34383459 Implementations</ h3 >
34393460
34403461 < p > To avoid clashes with future Selectors features, the Selectors
@@ -3457,7 +3478,7 @@ <h2 id=Tests>Tests</h2>
34573478 and does not cover all possible combined cases of Selectors.</p>
34583479-->
34593480
3460- < h2 id =acknowledgements > < span class =secno > 18 . </ span > Acknowledgements</ h2 >
3481+ < h2 id =acknowledgements > < span class =secno > 19 . </ span > Acknowledgements</ h2 >
34613482
34623483 < p > The CSS working group would like to thank everyone who contributed to
34633484 the < a href ="http://www.w3.org/TR/css3-selectors "> previous Selectors</ a >
@@ -3468,9 +3489,9 @@ <h2 id=acknowledgements><span class=secno>18. </span> Acknowledgements</h2>
34683489 the following for their specific contributions to Selectors Level 4: L.
34693490 David Baron Andrew Fedoniouk Ian Hickson Grey Hodge Jason Cranford Teague
34703491
3471- < h2 id =references > < span class =secno > 19 . </ span > References</ h2 >
3492+ < h2 id =references > < span class =secno > 20 . </ span > References</ h2 >
34723493
3473- < h3 id =normative-references > < span class =secno > 19 .1. </ span > Normative
3494+ < h3 id =normative-references > < span class =secno > 20 .1. </ span > Normative
34743495 References</ h3 >
34753496 <!--begin-normative-->
34763497 <!-- Sorted by label -->
@@ -3533,7 +3554,7 @@ <h3 id=normative-references><span class=secno>19.1. </span> Normative
35333554 </ dl >
35343555 <!--end-normative-->
35353556
3536- < h3 id =informative-references > < span class =secno > 19 .2. </ span > Informative
3557+ < h3 id =informative-references > < span class =secno > 20 .2. </ span > Informative
35373558 References</ h3 >
35383559 <!--begin-informative-->
35393560 <!-- Sorted by label -->
0 commit comments