You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
is()/:where() with complex selectors containing :nth-child()` fails to match #165
Root cause: The logicalsel regex on line 81 uses [^()]*|.* where the greedy .* consumes past the closing ) of :is() when content has nested parens from :not() or :nth-child().
Suggested fix: Replace '[^()]*|.*' with '[^()]*(?:\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)[^()]*)*' for balanced parenthesis matching up to 2 levels.
I cannot reproduce this on master at 2e9498f, which is 2.2.27: all three selectors from the report return the div[role=button], including the one marked as failing.
That finds the div on master. So do three narrower shapes I tried to isolate the reported one: :is(tr:not([data-group-level]) > *:nth-child(1)) [role=button], :is(tr > *:nth-child(1)) [role=button], and :is(:not([data-x]) > *:nth-child(1)) [role=button].
So whatever broke it looks to have been fixed between the version you hit and current master.
Is it still failing for you on 2.2.27? If it is, the version and the surrounding markup would pin it down, since the shape alone passes here.
The reported selector now returns the expected button on current master, for both :is() and :where(). I verified both forms during the merge audit. Nested logical arguments are now handled by the balanced scanner from merged #179. Closing this report as addressed in source; this does not indicate that a new npm release has been published.
Activity
jdalton commentedon Sep 5, 2026
I cannot reproduce this on master at
2e9498f, which is 2.2.27: all three selectors from the report return thediv[role=button], including the one marked as failing.What I ran, and the variations I tried around it
That finds the div on master. So do three narrower shapes I tried to isolate the reported one:
:is(tr:not([data-group-level]) > *:nth-child(1)) [role=button],:is(tr > *:nth-child(1)) [role=button], and:is(:not([data-x]) > *:nth-child(1)) [role=button].So whatever broke it looks to have been fixed between the version you hit and current master.
Is it still failing for you on 2.2.27? If it is, the version and the surrounding markup would pin it down, since the shape alone passes here.
jdalton commentedon Sep 6, 2026
The reported selector now returns the expected button on current master, for both :is() and :where(). I verified both forms during the merge audit. Nested logical arguments are now handled by the balanced scanner from merged #179. Closing this report as addressed in source; this does not indicate that a new npm release has been published.