-
Notifications
You must be signed in to change notification settings - Fork 88
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:has(selector)
matches nodes matched by selector
#122
Comments
This was referenced Jun 25, 2021
Can still reproduce this, e.g. The cause is Lines 179 to 191 in 07ee329
enter and leave visit node too. A simple fix is master...lukaw3d:esquery:remove-parent-from-has
estraverse.traverse(node, {
enter (descendant, parent) {
if (node === descendant) return;
...
leave (descendant) {
if (node === descendant) return;
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
esquery v1.4.0
Or. in the esquery demo, enter
1
as code,:has(Literal)
as selector. It finds"Program"
,"ExpressionStatement"
, and"Literal"
.I was expecting that selectors in
:has()
can match only descendants of the node, but in the above examples:has(Literal)
matches aLiteral
node. Is this the intended behavior?The text was updated successfully, but these errors were encountered: