sass / sass

Sass makes CSS fun!

Home Page:https://sass-lang.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle placeholders in selector pseudos more semantically

nex3 opened this issue · comments

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;
}