Skip to content

Commit 724bb40

Browse files
committed
Fix exception on selector list in select
1 parent 1ee84f3 commit 724bb40

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/any.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class Collector {
182182
if (this.one) {
183183
// Shouldn’t happen, safeguards performance problems.
184184
/* c8 ignore next */
185-
if (this.found) throw new Error('Cannot collect multiple nodes')
185+
if (this.found) return
186186
this.found = true
187187
}
188188

test/select.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ test('select.select()', (t) => {
7676
'nothing if not given an element'
7777
)
7878

79+
t.deepEqual(
80+
select('h1, h2', h('main', [h('h1', 'Alpha'), h('h2', 'Bravo')])),
81+
h('h1', 'Alpha'),
82+
'should select one of several elements'
83+
)
84+
7985
t.end()
8086
})
8187

0 commit comments

Comments
 (0)