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] misleading/incomplete Note: clarify that <forgiving-selector-list> does not work as expected with pseudo-elements #6792

Closed
claudepache opened this issue Nov 3, 2021 · 4 comments

Comments

@claudepache
Copy link
Contributor

The Note in Section 17.1 <forgiving-selector-list> and <forgiving-relative-selector-list> says:

Note: Style rules still use the normal, unforgiving selector list behavior. <forgiving-selector-list> is used in some functions, like :is(), which are similarly generic. Although it does have some minor implications on specificity, simply wrapping a style rule’s selector in :is() effectively "upgrades" it to become forgiving.

There is however a much more serious implication than specificity when the selector list targets pseudo-elements. The following won’t work as naïvely expected (js-bin live example):

:is(button, input[type=button], input[type=submit], ::file-selector-button) {
    background: fuchsia;
}
@tabatkins
Copy link
Member

The "implication" is just that pseudo-elements aren't valid in :is(), right?

@tabatkins tabatkins added the selectors-4 Current Work label Nov 3, 2021
@Loirooriol
Copy link
Contributor

That's already implied in the spec:

Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is().

#2284 is about making them valid (deferred to L5)

Forbidding pseudo-elements in forgiving selector lists will also cover :has(), which seems good.

@claudepache
Copy link
Contributor Author

Just for clarity. Both specificity and pseudo-element handling of :is() are correctly mentioned in the spec. My issue is that (unless #2284 is fixed) the specific Note in section 17.1 is currently misleading, because developers will try to wrap some selector list containing some partially supported pseudo-element with :is().

@claudepache claudepache changed the title [selectors-4] clarify that <forgiving-selector-list> does not work as expected with pseudo-elements [selectors-4] misleading/incomplete Note: clarify that <forgiving-selector-list> does not work as expected with pseudo-elements Nov 3, 2021
@tabatkins
Copy link
Member

All right, text amended to clarify that you can't "upgrade" a selector list that contains pseudo-elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants