Skip to content

Fix :has() sibling matching at root elements - #169

Open
nrps9909 wants to merge 1 commit into
dperini:masterfrom
nrps9909:codex/guard-has-sibling-root
Open

Fix :has() sibling matching at root elements#169
nrps9909 wants to merge 1 commit into
dperini:masterfrom
nrps9909:codex/guard-has-sibling-root

Conversation

@nrps9909

Copy link
Copy Markdown

Fixes #168.

This restores the parentElement guard before compiling adjacent- and general-sibling relational selectors inside :has(). Without it, matching a compound selector can reach the document root and dereference its null parent.

The new browser regression test covers both sibling forms at the root and a positive compound-selector case.

Validation:

  • node --check src/nwsapi.js
  • direct patched-source checks: root adjacent false, root general sibling false, compound sibling true
  • test/has-sibling-root.html under JSDOM: data-result=pass, no script errors
  • Ant Design #59151 exact head: released 2.2.25 fails 6/55 affected Tooltip tests; this local package passes 55/55 with 5 snapshots
  • git diff --check

The repository's current ESLint configuration reports 185 pre-existing errors across src/nwsapi.js when run with ES6 parsing; this patch does not introduce a new lint rule or broad cleanup.

AI assistance disclosure: Codex was used to trace and minimize the regression, prepare the focused patch and regression test, and draft this description. I reviewed the diff and reproduced all validation locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant