Infinite loop on ":where" selector
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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