Skip to content

fix: backport has selector validation to v2 - #216

Merged
dperini merged 1 commit into
masterfrom
fix/has-validation-v2
Sep 22, 2026
Merged

dperini merged 1 commit into
masterfrom
fix/has-validation-v2

Conversation

@jdalton

@jdalton jdalton commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Invalid :has() arguments can be accepted on empty queries, nested :has() can match, and wildcard namespaces are rejected on v2. Backport v3's eager logical validation and forgiving-branch handling so these selectors follow the same rules across all eight DOM selector APIs. Changing VERBOSITY also clears compiled failures so verbose retries throw correctly.

This preserves v2's released source layout, ES2015 syntax, and existing matching and cache architecture. It adds 18 focused regression tests and runs both maintenance suites through npm test.

Validation:

  • All 36 maintenance tests pass. The new suite reproduces 17 failures against the current master source.
  • All 112 subtests across seven pinned WPT :has() pages pass, up from 105 passing and seven failing. The same pages pass on v3. The separate :has-slotted pseudo-class is outside this backport.
  • WPT revision: fd983776a7cd19ebcda7a2bcb69c74330ee5d8c9, Chrome for Testing 154.0.8037.0. Parsing pages use the existing DOM selector-validity helper. Every selected subtest runs without result filtering.
  • node --check src/nwsapi.js and the existing ES2015 parse check pass.

@jdalton
jdalton force-pushed the fix/has-validation-v2 branch from 24782fd to 2737fcc Compare September 17, 2026 17:37
@jdalton jdalton changed the title Backport :has() validation fixes to v2 fix: backport has selector validation to v2 Sep 22, 2026
@jdalton
jdalton force-pushed the fix/has-validation-v2 branch from 2737fcc to 3bd9acb Compare September 22, 2026 17:41
@jdalton
jdalton force-pushed the fix/has-validation-v2 branch from 3bd9acb to 7bf134e Compare September 22, 2026 18:23
@dperini
dperini merged commit 75010e1 into master Sep 22, 2026
2 checks passed
@jdalton
jdalton deleted the fix/has-validation-v2 branch September 22, 2026 18:25
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