Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[selectors-4] Allow logical combination pseudos wherever their arguments are themselves valid. #7085 #8041

Merged
merged 1 commit into from
Dec 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions selectors-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,6 @@ Pseudo-classing Pseudo-elements</h4>
unless otherwise-specified, none of these <a>pseudo-classes</a>
will match on the <a>pseudo-element</a>.

Issue: Clarify that '':not()'' and '':is()'' can be used when containing above-mentioned pseudos.

<div class="example">
For example, since the '':hover'' pseudo-class specifies
that it can apply to any pseudo-element,
Expand All @@ -831,8 +829,14 @@ Pseudo-classing Pseudo-elements</h4>
whereas ''::first-line:hover'' only matches if the first line itself is hovered.
</div>

The [=logical combination pseudo-classes=]
'':not()'', '':is()'', and '':where()''
are also valid immediately following a [=pseudo-element=]
provided their arguments all adhere to the above restriction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that ::before:is(:hover, :first-child) is completely invalid, or becomes ::before:is(:hover)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the latter would be more consistent with standard behavior, so I'll update the PR.


Note: Note that, unless otherwise specified in a future specification,
pseudo-classes other than the <a href="#useraction-pseudos">user action pseudo-classes</a>
(and logical combination pseudo-classes restricted to them)
are not valid when compounded to a pseudo-element;
so, for example, ''::before:first-child'' is an invalid selector.

Expand Down Expand Up @@ -988,6 +992,22 @@ Invalid Selectors and Error Handling</h3>
<h2 id="logical-combination">
Logical Combinations</h2>

Selector logic can be manipulated by
[=compound selector|compounding=] (logical AND),
[=selector lists=] (logical OR),
and the <dfn>logical combination pseudo-classes</dfn>
'':is()'', '':where()'', and '':not()''.
The [=logical combination pseudo-classes=]
are allowed anywhere that any other [=pseudo-classes=] are allowed,
but pass any restrictions to their arguments.
(For example, if only [=compound selectors=] are allowed,
then only [=compound selectors=] are valid within an '':is()''.)

Note: Since inside '':is()'' and '':where()''
invalid arguments are dropped without invaliding the [=pseudo-class=] itself,
selector arguments that are invalidated by contextual restrictions
likewise do not invalidate the '':is()'' pseudo-class itself.

<h3 id="grouping">
Selector Lists</h3>

Expand Down