Can't use parent-sensitive pseudoselectors with :not
apaleslimghost opened this issue · comments
Kara Brightwell commented
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
hast-util-select@7.0.0
Link to runnable example
https://runkit.com/quarterto/6397058cb17f2300086ba513
Steps to reproduce
import {h} from 'hastscript'
import {selectAll} from 'hast-util-select'
selectAll('img:not(:first-child)`, h('body', [
h('img', { src: 'https://example.com/one' }),
h('p', ['text']),
h('img', { src: 'https://example.com/two' }),
]))
Expected behavior
it selects the second img
Actual behavior
Error: Cannot use `:first-child` without parent
this is because :not
is implemented using matches
, which doesn't support parent-sensitive pseudos
Affected runtime and version
node@14, node@16
Affected package manager and version
No response
Affected OS and version
No response
Build and bundle tools
No response
Titus commented
Ah, interesting.
Want to work on a PR?
github-actions commented
Hi! This was closed. Team: If this was fixed, please add phase/solved
. Otherwise, please add one of the no/*
labels.