Skip to content

Commit

Permalink
Fix exception on selector list in select
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 30, 2021
1 parent 1ee84f3 commit 724bb40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/any.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class Collector {
if (this.one) {
// Shouldn’t happen, safeguards performance problems.
/* c8 ignore next */
if (this.found) throw new Error('Cannot collect multiple nodes')
if (this.found) return
this.found = true
}

Expand Down
6 changes: 6 additions & 0 deletions test/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ test('select.select()', (t) => {
'nothing if not given an element'
)

t.deepEqual(
select('h1, h2', h('main', [h('h1', 'Alpha'), h('h2', 'Bravo')])),
h('h1', 'Alpha'),
'should select one of several elements'
)

t.end()
})

Expand Down

0 comments on commit 724bb40

Please sign in to comment.