Skip to content

Commit af7e634

Browse files
committed
[css-scoping][selectors] Per WG resolution, define that tree-abiding pseudos are allowed after ::slotted(). Fixes #1747.
1 parent 0b0aa0a commit af7e634

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

css-scoping/Overview.bs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ spec:html; type:element; text:style
2525
spec:selectors-4; type:dfn;
2626
text: static profile
2727
text: dynamic profile
28+
spec:css-pseudo-4; type:selector;
29+
text:::before
30+
text:::after
2831
spec:cascade-4; type:dfn; text: inherit
2932
</pre>
3033

@@ -341,6 +344,10 @@ Selecting Slot-Assigned Content: the ''::slotted()'' pseudo-element</h4>
341344
* <a lt="find flattened slotables">assigned, after flattening,</a> to the <a>slot</a> that is ''::slotted''’s originating element
342345
* <a lt="match a selector against an element">matched</a> by its <<compound-selector-list>> argument
343346

347+
The ''::slotted()'' pseudo-element can be followed by a <a>tree-abiding pseudo-element</a>,
348+
like ''::slotted()::before'',
349+
representing the appropriate pseudo-element of the elements represented by the ''::slotted()'' pseudo-element.
350+
344351
<div class="example">
345352
For example, say you had a component with both children and a shadow tree,
346353
like the following:

selectors/Overview.bs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,16 +3207,29 @@ Grammar</h2>
32073207
with only a single ":" character at their start.
32083208
* In <<id-selector>>, the <<hash-token>>’s value must be an <a>identifier</a>.
32093209

3210-
Issue: Should I consider the "only one pseudo-element per complex selector, at the end of the last compound selector" rule now trashed?
3211-
In practice, all implementations violate that rule to at least some extent.
3212-
32133210
Note: The grammar above states that a combinator is optional
32143211
between two <<compound-selector>>s in a <<complex-selector>>.
32153212
This is only for grammatical purposes,
32163213
as the <a>CSS Value Definition Syntax</a>'s lax treatment of whitespace
32173214
makes it difficult to indicate that a grammar term can <em>be</em> whitespace.
32183215
"Omitting" a combinator is actually just specifying the <a>descendant combinator</a>.
32193216

3217+
Note: While, per the grammar,
3218+
<a>pseudo-elements</a> can appear anywhere in a <<compound-selector>>,
3219+
and a <<compound-selector>> with a <<pseudo-element-selector>>
3220+
can appear anywhere in a <<complex-selector>>,
3221+
in practice the <<pseudo-element-selector>> will only match anything
3222+
if placed at the end of the last <<compound-selector>>
3223+
in a <<complex-selector>>.
3224+
In some circumstances,
3225+
it can be followed by more <<pseudo-element-selector>>s or <<pseudo-class-selector>>s
3226+
in the same <<compount-selector>>,
3227+
but these are specified on a case-by-case basis.
3228+
(For example, the <a>user-action pseudo-classes</a> are allowed after any <a>pseudo-element</a>,
3229+
and the <a>tree-abiding pseudo-elements</a>
3230+
are allowed after the ''::slotted()'' pseudo-element)
3231+
3232+
32203233

32213234
<h2 id='api-hooks'>
32223235
API Hooks</h2>

0 commit comments

Comments
 (0)