Skip to content

Handle placeholders in selector pseudos more semantically #2228

@nex3

Description

@nex3

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy