Fix :has() sibling matching at root elements - #169
Open
nrps9909 wants to merge 1 commit into
Open
Conversation
17 tasks
nrps9909
force-pushed
the
codex/guard-has-sibling-root
branch
from
August 29, 2026 03:50
dcff913 to
e33a8ae
Compare
1 task
dperini
added a commit
that referenced
this pull request
Aug 30, 2026
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #168.
This restores the
parentElementguard 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.jsfalse, root general siblingfalse, compound siblingtruetest/has-sibling-root.htmlunder JSDOM:data-result=pass, no script errorsgit diff --checkThe repository's current ESLint configuration reports 185 pre-existing errors across
src/nwsapi.jswhen 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.