File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ test('createElementFromAttrs', () => {
1010 class : 'cls-1 cls-2' ,
1111 'data-foo' : 'the-data' ,
1212 disabled : true ,
13+ checked : false ,
1314 required : null ,
15+ tabindex : 0 ,
1416 } ) ;
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>' ) ;
1618} ) ;
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ export function createElementFromAttrs(tagName, attrs) {
297297 const el = document . createElement ( tagName ) ;
298298 for ( const [ key , value ] of Object . entries ( attrs ) ) {
299299 if ( value === undefined || value === null ) continue ;
300- if ( value === true ) {
300+ if ( typeof value === 'boolean' ) {
301301 el . toggleAttribute ( key , value ) ;
302302 } else {
303303 el . setAttribute ( key , String ( value ) ) ;
You can’t perform that action at this time.
0 commit comments