Skip to content

Add a selector equality check #228

Closed

Description

@nex3

One thing I would find very useful is the ability to check if two selectors are semantically equal. I'm currently comparing the string representations of selectors, but that doesn't capture the fact that (for example) :is(a, b) means the same thing as :is(b, a) or that [a=\-1] means the same thing as [a="-1"]. postcss-selector-parser notionally has enough information in its AST to make these comparisons, so it would be awesome if that logic was implemented and made available as an API.

For prior art, it may be useful to look at Dart Sass's AST and in particular implementations of the operator == and hash methods.

Activity

  1. MoOx commented on Nov 8, 2026

    @MoOx
    Collaborator

    Parked in #357, which collects the design issues that would need a major. This is not a rejection: if it blocks you, say so in #357 with a concrete use case and it can be taken back out.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions