File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -718,9 +718,7 @@ export default class HTMLElement extends Node {
718
718
this . rawAttrs = Object . keys ( attrs )
719
719
. map ( ( name ) => {
720
720
const val = this . quoteAttribute ( attrs [ name ] ) ;
721
- if ( val === undefined || val === 'null' ) {
722
- return name ;
723
- }
721
+ if ( val === 'null' || val === '""' ) return name ;
724
722
return `${ name } =${ val } ` ;
725
723
} )
726
724
. join ( ' ' ) ;
Original file line number Diff line number Diff line change
1
+ const { parse } = require ( '@test/test-target' ) ;
2
+
3
+ describe ( 'issue 258' , function ( ) {
4
+ it ( 'removeAttribute makes boolean attributes render incorrectly.' , function ( ) {
5
+ const inputEl = parse ( '<input>' ) . firstChild
6
+
7
+ inputEl . setAttribute ( 'checked' , '' ) ;
8
+ inputEl . setAttribute ( 'a' , '' ) ;
9
+ inputEl . toString ( ) . should . eql ( '<input checked a>' ) ;
10
+
11
+ inputEl . removeAttribute ( 'a' ) ;
12
+ inputEl . toString ( ) . should . eql ( '<input checked>' ) ;
13
+ console . log ( inputEl . toString ( ) ) ; // => <input checked=""> INCORRECT
14
+ // div.innerText.should.eql(`Hello World`);
15
+ } ) ;
16
+ } ) ;
You can’t perform that action at this time.
0 commit comments