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
Nested logical selectors are handled correctly. However, chained (adjacent?) ones are not. See minimal test cases below.
// all of these selectors match all elements
// does not crash and works correctly
:is(*)
:is(:is(*))
// crashes with SyntaxError unknown pseudo-class selector
:is(*):is(*)
:is(:is(*):is(*))
is(*):is(:is(*))
There are many related issues that are all fundamentally due to this same issue.
Someone on Issue #28 suggests using a parser instead of regex to handle these situations. I think that could work—using regex to find the initial logical selector and then a parser to segment the contents.
However, I experimented with a balanced parentheses matcher regex, and did get a working solution going with a configurable depth that fixes the above test cases and only fails on selectors deeper than its depth. I'm not sure about the performance characteristics of it though. I'd assume it's not the best, but it seems correct.
// depth=3
// crashes with SyntaxError unknown pseudo-class selector
:is(:is(:is(:is(:is(*)))))
I've checked it against has basic, has relative, not complex, is where basic, and is nested, and had no regressions. PR is linked
The text was updated successfully, but these errors were encountered:
Nested logical selectors are handled correctly. However, chained (adjacent?) ones are not. See minimal test cases below.
There are many related issues that are all fundamentally due to this same issue.
Related Issues
#128
#127
#135 (comment)
#124
#123
#89
Someone on Issue #28 suggests using a parser instead of regex to handle these situations. I think that could work—using regex to find the initial logical selector and then a parser to segment the contents.
However, I experimented with a balanced parentheses matcher regex, and did get a working solution going with a configurable depth that fixes the above test cases and only fails on selectors deeper than its depth. I'm not sure about the performance characteristics of it though. I'd assume it's not the best, but it seems correct.
I've checked it against has basic, has relative, not complex, is where basic, and is nested, and had no regressions. PR is linked
The text was updated successfully, but these errors were encountered: