leeoniya / leeoniya/dropcss

Infinite loop on ":where" selector

Open
#62 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2.1k
Forks
64
PR merge metrics
No merged PRs in 30d

Description

Hi,

It seems like DropCSS loops forever when encountering the ":where" selector. It is relevant to me because I tried to use it on the Open Props Normalize stylesheet. After failing I then tried to pinpoint the exact statement that causes the issue and It turns out that DropCSS just hangs on every ":where" selector. Here is a codepen that demonstrates the problem .

I don't understand the internals of this project very well but I'm open to contributing a bug fix if someone just points me in the right direction. Maybe all those compiler architecture lectures won't go to waste after all 😉.

As a side note I tried all other dead css eliminators (that I'm aware of) and they all seemed to struggle with ":where" too:

  • PurgeCSS - removed all ":where" selectors including the used ones
  • PurifyCSS - didn't remove any ":where" selectors
  • UnCSS - didn't remove any ":where" selectors

So it would be cool if DropCSS was the first one to actually support it. If we get it working we might even get added to the Open Props documentation since the project is still developing and Adam seems to care about performance a lot.

Anyway, thank you for all your work and this wonderful project.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodePen reproduction and verify that processing a stylesheet containing a :where selector hangs. Trace the selector-processing path until the loop is identified, then confirm that the reproduction completes while preserving supported :where selectors.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.