Skip to content

Commit 1e9159e

Browse files
committed
[selector-4][editorial] Add a note spelling out the interaction of relative-selector vs compound-selector restrictions in :has().
1 parent cdda267 commit 1e9159e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

selectors-4/Overview.bs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,12 @@ The Relational Pseudo-class: '':has()''</h3>
12691269
many of them exist conditionally, based on the styling of their ancestors,
12701270
so allowing these to be queried by '':has()'' would introduce cycles.
12711271

1272+
Note: Since '':has()'' takes a <<relative-selector-list>>,
1273+
its arguments are <em>inherently</em> [=complex selectors=]
1274+
(because they start, perhaps implicitly, with a combinator).
1275+
This means '':has()'' cannot be used in contexts that don't allow complex selectors;
1276+
its arguments will be guaranteed to be invalid.
1277+
12721278
<div class='example'>
12731279
For example, the following selector matches only
12741280
<code>&lt;a></code> elements that contain an <code>&lt;img></code> child:

0 commit comments

Comments
 (0)