Skip to content

Commit

Permalink
[selectors-4] Disallow pseudo-elements from :has unless on an allowli…
Browse files Browse the repository at this point in the history
…st. #7463
  • Loading branch information
tabatkins committed Aug 24, 2022
1 parent 7fec041 commit 7e5fe71
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion selectors-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,17 @@ The Relational Pseudo-class: '':has()''</h3>
would match at least one element
when [=anchor element|anchored against=] this element.

'':has()'' pseudo-class cannot be nested; '':has()'' is not valid within '':has()''.
The '':has()'' pseudo-class cannot be nested;
'':has()'' is not valid within '':has()''.
Also, unless explicitly defined as a
<dfn dfn export>:has-allowed pseudo-element</dfn>,
[=pseudo-elements=] are not valid selectors within '':has()''.
(This specification does not define any [=:has-allowed pseudo-elements=],
but other specifications may do so.)

Note: Pseudo-elements are generally excluded from '':has()'' because
many of them exist conditionally, based on the styling of their ancestors,
so allowing these to be queried by '':has()'' would introduce cycles.

<div class='example'>
For example, the following selector matches only
Expand Down

0 comments on commit 7e5fe71

Please sign in to comment.