File tree 2 files changed +4
-2
lines changed 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ test('createElementFromAttrs', () => {
10
10
class : 'cls-1 cls-2' ,
11
11
'data-foo' : 'the-data' ,
12
12
disabled : true ,
13
+ checked : false ,
13
14
required : null ,
15
+ tabindex : 0 ,
14
16
} ) ;
15
- expect ( el . outerHTML ) . toEqual ( '<button id="the-id" class="cls-1 cls-2" data-foo="the-data" disabled=""></button>' ) ;
17
+ expect ( el . outerHTML ) . toEqual ( '<button id="the-id" class="cls-1 cls-2" data-foo="the-data" disabled="" tabindex="0" ></button>' ) ;
16
18
} ) ;
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ export function createElementFromAttrs(tagName, attrs) {
297
297
const el = document . createElement ( tagName ) ;
298
298
for ( const [ key , value ] of Object . entries ( attrs ) ) {
299
299
if ( value === undefined || value === null ) continue ;
300
- if ( value === true ) {
300
+ if ( typeof value === 'boolean' ) {
301
301
el . toggleAttribute ( key , value ) ;
302
302
} else {
303
303
el . setAttribute ( key , String ( value ) ) ;
You can’t perform that action at this time.
0 commit comments