Skip to content
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

(WIP) fix: correctly mark :not selectors #14176

Closed
wants to merge 1 commit into from

Conversation

dummdidumm
Copy link
Member

This is a start at trying to properly fix the matching behavior of :not selectors (#14168). I'm in favor of cancling the endeavour because in my opinion it's just too complicated to do correctly and will make the whole css-prune.js file a hot mess - frankly it already is very complicated, and this would boost that even further.

The idea is to recognize when we're in a :not selector to revert the "did not match" logic. That itself sounds easy enough, but doesn't suffice at all. There are loads of special cases, which all need extra code:

  • if there's a :global(...) we're right now assuming "yeah it matches", but we can't assume "yeah it does not match" for :not, because it could.
  • for everything with multiple options where we iterative over selectors we can't say "one of them matched, so :not does not apply", instead we also gotta keep track of "on of them did not match, so :not applies"
  • for dynamic bits like class: or <svelte:element> we gotta assume it does match, even within :not
  • probably many more cases I didn't think of right now

Copy link

changeset-bot bot commented Nov 6, 2024

⚠️ No Changeset found

Latest commit: 6d65cd6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Rich-Harris
Copy link
Member

preview: https://svelte-dev-git-preview-svelte-14176-svelte.vercel.app/

this is an automated message

Copy link
Contributor

github-actions bot commented Nov 6, 2024

Playground

pnpm add https://pkg.pr.new/svelte@14176

@dummdidumm dummdidumm closed this Nov 6, 2024
@dummdidumm dummdidumm deleted the not-selector-complicated-fix branch November 6, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants