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

Handle placeholders in selector pseudos more semantically #2228

Closed
nex3 opened this Issue Jan 15, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@nex3
Contributor

nex3 commented Jan 15, 2017

Right now, no complex selectors containing un-extended placeholders in any context are rendered. This makes sense in most cases, but for selector pseudos it doesn't always. We generally treat placeholder selectors as though they're selectors that match no elements, and our current scheme doesn't always respect those semantics.

In general, if a selector pseudo contains a selector list, its complex parent should be hidden if and only if the entire selector list in the selector pseudo would be hidden.

The :not() pseudo is a special case. If its entire selector list would be hidden, it doesn't hide its parent; instead, it's treated as though it matched every element. This means it's stripped from its compound selector, and if that selector would be empty it's replaced with the universal selector *.

For example:

a:matches(%b) {x: y}
a:matches(%b, c) {x: y}
a:not(%b) {x: y}
a:not(%b, c) {x: y}
:not(%b) {x: y}

would compile to:

a:matches(c) {
  x: y;
}

a {
  x: y;
}

a:not(c) {
  x: y;
}

* {
  x: y;
}
@nex3

This comment has been minimized.

Contributor

nex3 commented Jan 15, 2017

cc @xzyfer

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