File tree Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import {ok as assert} from 'devlop'
17
17
* Whether `element` matches `query`.
18
18
*/
19
19
export function id ( query , element ) {
20
- assert ( query . ids , 'expected ` ids`' )
21
- const id = query . ids [ query . ids . length - 1 ]
22
- return Boolean ( element . properties . id === id )
20
+ const ids = query . ids
21
+ assert ( ids , 'expected `ids`' )
22
+ return ids . length === 1 && element . properties . id === ids [ 0 ]
23
23
}
Original file line number Diff line number Diff line change @@ -183,19 +183,13 @@ test('select.matches()', async function (t) {
183
183
assert . ok ( ! matches ( '#two' , h ( '#one' ) ) )
184
184
} )
185
185
186
- await t . test (
187
- 'should prefer the last id if multiple id’s are specified (1)' ,
188
- async function ( ) {
189
- assert . ok ( matches ( '#two#one' , h ( '#one' ) ) )
190
- }
191
- )
186
+ await t . test ( 'should never match multiple ids (#1)' , async function ( ) {
187
+ assert . ok ( ! matches ( '#a#x' , h ( '#a' ) ) )
188
+ } )
192
189
193
- await t . test (
194
- 'should prefer the last id if multiple id’s are specified (2)' ,
195
- async function ( ) {
196
- assert . ok ( ! matches ( '#one#two' , h ( '#one' ) ) )
197
- }
198
- )
190
+ await t . test ( 'should never match multiple ids (#2)' , async function ( ) {
191
+ assert . ok ( ! matches ( '#a#x' , h ( '#x' ) ) )
192
+ } )
199
193
} )
200
194
201
195
await t . test ( 'class: `.class`' , async function ( t ) {
You can’t perform that action at this time.
0 commit comments