@@ -3543,7 +3543,9 @@ Grammar</h2>
35433543 <dfn><pseudo-class-selector></dfn> = ':' <<ident-token>> |
35443544 ':' <<function-token>> <<any-value>> ')'
35453545
3546- <dfn><pseudo-element-selector></dfn> = ':' <<pseudo-class-selector>>
3546+ <dfn><pseudo-element-selector></dfn> = ':' <<pseudo-class-selector>> | <<legacy-pseudo-element-selector>>
3547+
3548+ <dfn><legacy-pseudo-element-selector></dfn> = ':' [before | after | first-line | first-letter]
35473549 </pre>
35483550
35493551 In interpreting the above grammar,
@@ -3568,14 +3570,14 @@ Grammar</h2>
35683570 between two <<compound-selector>> s
35693571 if the <<combinator>> between them is omitted.
35703572 (This indicates the descendant combinator is being used.)
3571- <li id="single-colon-pseudos">
3572- The four <a href="https://www.w3.org/TR/CSS2/selectors.html#pseudo-element-selectors">Level 2</a> <a>pseudo-elements</a>
3573- (''::before'' , ''::after'' , ''::first-line'' , and ''::first-letter'' )
3574- may, for legacy reasons,
3575- be represented using the <<pseudo-class-selector>> grammar,
3576- with only a single ":" character at their start.
35773573 <li>
35783574 In <<id-selector>> , the <<hash-token>> ’s value must be an <a>identifier</a> .
3575+ <li>
3576+ The <<pseudo-class-selector>> production
3577+ excludes the <<legacy-pseudo-element-selector>> production.
3578+ (That is, '':before'' /etc must never be parsed as a pseudo-class,
3579+ even if doing so would cause the selector to become valid
3580+ due to, for example, other simple selectors following it.)
35793581 </ul>
35803582
35813583 Note: A selector is also subject to a variety of more specific syntactic constraints,
@@ -3594,6 +3596,13 @@ Grammar</h2>
35943596 and the <a>tree-abiding pseudo-elements</a>
35953597 are allowed after the ''::slotted()'' pseudo-element.)
35963598
3599+ <p class=note id=single-colon-pseudos>
3600+ The four <a href="https://www.w3.org/TR/CSS2/selectors.html#pseudo-element-selectors">Level 2</a> <a>pseudo-elements</a>
3601+ (''::before'' , ''::after'' , ''::first-line'' , and ''::first-letter'' )
3602+ may, for legacy reasons,
3603+ be written with only a single ":" character at their front,
3604+ making them resemble a <<pseudo-class-selector>> .
3605+
35973606<h3 id='forgiving-selector'>
35983607<<forgiving-selector-list>> and <<forgiving-relative-selector-list>></h3>
35993608
@@ -4051,6 +4060,8 @@ Changes since the 7 May 2022 Working Draft</h3>
40514060 (<a href="https://github.com/w3c/csswg-drafts/issues/3760">Issue 3760</a> )
40524061 * Defined '':-webkit-autofill'' [=legacy selector alias=] .
40534062 (<a href="https://github.com/w3c/csswg-drafts/issues/7474">Issue 7474</a> )
4063+ * Moved the legacy single-colon pseudo-element syntax into the grammar itself.
4064+ (<a href="https://github.com/w3c/csswg-drafts/issues/8122">Issue 8122</a> )
40544065
40554066<h3 id="changes-2018-11">
40564067Changes since the 21 November 2018 Working Draft</h3>
0 commit comments