Skip to content

Fix some :has() bugs.#166

Open
wRAR wants to merge 2 commits into
masterfrom
fix-has-combinator-translation
Open

Fix some :has() bugs.#166
wRAR wants to merge 2 commits into
masterfrom
fix-has-combinator-translation

Conversation

@wRAR

@wRAR wRAR commented Jul 15, 2026

Copy link
Copy Markdown
Member
  1. :has(> X) and :has(~ X) attach the inner condition to the wrong element
  2. :has(+ X) drops the subselector's condition and never matches *
  3. :not(:has(X)) translates to an always-true predicate — silently matches everything
  4. -of-type pseudo-classes and :scope chained after :has() emit malformed XPath

Found and fixed by an LLM, all test cases validated manually.

This rewrites the original :has() implementation to use conditions which fixes bugs and is cleaner.

The unused join() args are removed directly per

#### HERE BE DRAGONS

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.70%. Comparing base (743c6e5) to head (fba5de9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #166      +/-   ##
==========================================
+ Coverage   96.61%   96.70%   +0.09%     
==========================================
  Files           3        3              
  Lines         885      881       -4     
  Branches      136      133       -3     
==========================================
- Hits          855      852       -3     
  Misses         14       14              
+ Partials       16       15       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wRAR
wRAR marked this pull request as draft July 16, 2026 04:50
@wRAR
wRAR marked this pull request as ready for review July 16, 2026 17:58
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.

1 participant