Closed
Description
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
5.0.4
Link to runnable example
Steps to reproduce
import { selectAll } from "hast-util-select";
import { s } from "hastscript";
const tree = s("svg", [
s("circle", { fill: "#333" }),
s("circle", { fill: "none" }),
s("circle", { fill: "none" }),
s("circle"),
s("rect", { fill: "#666666" }),
s("rect", { fill: "none" }),
s("rect", { fill: "none" }),
s("rect", { fill: "none" }),
s("rect"),
]);
const result = selectAll("circle:not([fill]), rect:not([fill])", tree);
// Should select just 1 circle, 1 rect.
console.log(result);
// But we get:
// [
// { type: 'element', tagName: 'circle', properties: {}, children: [] },
// {
// type: 'element',
// tagName: 'rect',
// properties: { fill: '#666666' },
// children: []
// },
// {
// type: 'element',
// tagName: 'rect',
// properties: { fill: 'none' },
// children: []
// },
// {
// type: 'element',
// tagName: 'rect',
// properties: { fill: 'none' },
// children: []
// },
// {
// type: 'element',
// tagName: 'rect',
// properties: { fill: 'none' },
// children: []
// },
// { type: 'element', tagName: 'rect', properties: {}, children: [] }
// ]
Expected behavior
It should just 1 circle and 1 rect.
Actual behavior
It selects a bunch of elements that don't match the query.
Affected runtime and version
node@16.17.0, node@19.4.0
Affected package manager and version
No response
Affected OS and version
No response
Build and bundle tools
No response