Skip to content

[selectors] [cssom] How should invalid selectors inside :is(), :where(), and :not() be treated for serialization? #3676

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

Open
emilio opened this issue Feb 25, 2019 · 5 comments
Labels
selectors-4 Current Work

Comments

@emilio
Copy link
Collaborator

emilio commented Feb 25, 2019

Split from #3264. It's not clear what happens if you add an invalid selector inside :is or :not or :where in terms of serialization.

  • Should we just skip them?
  • Should we serialize it as :not(*|*) (like invalid media queries which serialize as not all)?
  • Something else?

/cc @ericwilligers

@ewilligers ewilligers added the selectors-4 Current Work label Feb 25, 2019
@ewilligers
Copy link
Contributor

I propose skipping them. When none of the selectors are vallid, we end up with :is(), :where(), :has(), :nth-child(even of), :nth-last-child(2n+1 of).

@emilio
Copy link
Collaborator Author

emilio commented Feb 25, 2019

Would those parse? We'd need them to roundtrip, you should be able to do ruleA.selectorText = ruleB.selectorText. We'd probably have to change the grammar of the property to allow 0 or more selectors.

@ewilligers
Copy link
Contributor

Would those parse?

Yes, they parse and roundtrip due to error recovery.

:not is excluded - empty and invalid selectors inside :not() do not parse (see resolution).

@emilio
Copy link
Collaborator Author

emilio commented Feb 25, 2019

So :not(<invalid>, <invalid>) would become :not(), and that would not parse?

Edit: NVM

@ewilligers
Copy link
Contributor

:not would be just like any other traditional selector with no error recovery. :not(<invalid>, <invalid>) and :nth-col(random .nonsense) do not parse, they never become :not() or :nth-col().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
selectors-4 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants