Skip to content

Commit 7e5fe71

Browse files
committed
[selectors-4] Disallow pseudo-elements from :has unless on an allowlist. w3c#7463
1 parent 7fec041 commit 7e5fe71

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

selectors-4/Overview.bs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,17 @@ The Relational Pseudo-class: '':has()''</h3>
11941194
would match at least one element
11951195
when [=anchor element|anchored against=] this element.
11961196

1197-
'':has()'' pseudo-class cannot be nested; '':has()'' is not valid within '':has()''.
1197+
The '':has()'' pseudo-class cannot be nested;
1198+
'':has()'' is not valid within '':has()''.
1199+
Also, unless explicitly defined as a
1200+
<dfn dfn export>:has-allowed pseudo-element</dfn>,
1201+
[=pseudo-elements=] are not valid selectors within '':has()''.
1202+
(This specification does not define any [=:has-allowed pseudo-elements=],
1203+
but other specifications may do so.)
1204+
1205+
Note: Pseudo-elements are generally excluded from '':has()'' because
1206+
many of them exist conditionally, based on the styling of their ancestors,
1207+
so allowing these to be queried by '':has()'' would introduce cycles.
11981208

11991209
<div class='example'>
12001210
For example, the following selector matches only

0 commit comments

Comments
 (0)