-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
Given the following minimal example program,
import js from "@eslint/js";the ESQuery expression Program > ImportDeclaration > Literal matches the Literal node as expected,
{
type: 'Literal',
start: 15,
end: 27,
value: '@eslint/js',
raw: '"@eslint/js"',
}but the expression Program:has(> ImportDeclaration > Literal) does not match the Program node.
This seems odd, as the simpler selector Program:has(> ImportDeclaration) matches the Program node.
And to sanity-check this, here's an equivalent example using CSS selectors which behaves as expected:
const doc = new DOMParser().parseFromString('<span>Hello, world!</span>', 'text/html');
console.log(doc.querySelector('html > body > span'));
console.log(doc.querySelector('html:has( > body > span)'));
// Output:
// <span>Hello, world!</span>
// <html>...</html>michaelficarra and sadan4
Metadata
Metadata
Assignees
Labels
No labels