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][Editorial] Are things like :is(.foo *) still a <compound-selector>? #6737

Closed
LeaVerou opened this issue Oct 17, 2021 · 3 comments

Comments

@LeaVerou
Copy link
Member

Currently there are various specs that restrict selector arguments to <compound-selector> for performance reasons. E.g. :host and :host-context().

However, given how <compound-selector> is defined, things like :is(.foo .bar *) or :not(.foo .bar *) still match its grammar:

<compound-selector> = [ <type-selector>? <subclass-selector>*
                        [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!
[...]
<pseudo-class-selector> = ':' <ident-token> |
                          ':' <function-token> <any-value> ')'

So technically, things like :host-context(:is(.foo .bar *)) should be allowed, even though they currently are not in implementations and I guess should not be. Am I missing something or do these grammars need fixing? Perhaps we need a <restricted-compound-selector> or something?

cc @tabatkins

@tabatkins
Copy link
Member

Fixing up some of the tags, since this is definitely not editorial.

(I'm not sure what the right answer is, but I've brought this up independently in another issue now, too.)

@tabatkins
Copy link
Member

But I will say, if the perf requirements are still valid, then we should switch to a production that explicitly prohibits pseudo-classes from containing complex selectors. If they're not, then we should stop pretending there's a restriction, and just relax it to <selector>.

@tabatkins
Copy link
Member

(Closing as a dupe of #5093)

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

3 participants