css-selector-parser icon indicating copy to clipboard operation
css-selector-parser copied to clipboard

Error parsing nested operators inside pseudo without a tagName (ex. `div:has(>label+input)`)

Open gmathieu opened this issue 5 years ago • 0 comments

Hello,

I'm trying to match a div which contains direct children of an input and a label div:has(>input+label). This throws the following exception: Expected ")" but ">" found.. I've tested this selector with Sizzle which appears to be handling it fine.

What am I missing? Is there another way to write this that achieves the same result?

Here's a sandbox to play around with it: https://codesandbox.io/s/css-selector-parser-direct-children-lgp6b?file=/src/index.ts

Note: div:has(*>input+label) and div>input+label can be parsed but return very different elements.

This is a great library otherwise! Thank you for your time.

gmathieu avatar Oct 01 '20 21:10 gmathieu