Skip to content

Commit 4ee85b0

Browse files
committed
Fix :matches, :not after something matched
Closes GH-6.
1 parent a0681a0 commit 4ee85b0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/pseudo.js

+4
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ function has(query, element, _1, _2, state) {
261261
/** @type {SelectState} */
262262
const childState = {
263263
...state,
264+
// Not found yet.
265+
found: false,
264266
// Do walk deep.
265267
shallow: false,
266268
// One result is enough.
@@ -344,6 +346,8 @@ function matches(query, element, _, parent, state) {
344346
/** @type {SelectState} */
345347
const childState = {
346348
...state,
349+
// Not found yet.
350+
found: false,
347351
// Do walk deep.
348352
shallow: false,
349353
// One result is enough.

test/core.js

+9
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,13 @@ test('all together now', () => {
119119
h('dd', 'Hotel')
120120
]
121121
)
122+
123+
assert.deepEqual(
124+
selectAll(
125+
'a:not([class])',
126+
u('root', [h('a#w.a'), h('a#x'), h('a#y.b'), h('a#z')])
127+
),
128+
[h('a#x'), h('a#z')],
129+
'should support `:not` with multiple matches (GH-6)'
130+
)
122131
})

0 commit comments

Comments
 (0)