File tree 3 files changed +27
-1
lines changed
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -453,6 +453,14 @@ export default class HTMLElement extends Node {
453
453
this . childNodes [ o ++ ] = node ;
454
454
} ) ;
455
455
this . childNodes . length = o ;
456
+
457
+ // remove whitespace between attributes
458
+ const attrs = Object . keys ( this . rawAttributes ) . map ( ( key ) => {
459
+ const val = this . rawAttributes [ key ] ;
460
+ return `${ key } =${ JSON . stringify ( val ) } ` ;
461
+ } ) . join ( ' ' ) ;
462
+ this . rawAttrs = attrs ;
463
+ delete this . _rawAttrs ;
456
464
return this ;
457
465
}
458
466
Original file line number Diff line number Diff line change
1
+ const { parse } = require ( '@test/test-target' ) ;
2
+
3
+ describe ( 'issue 274' , function ( ) {
4
+ it ( 'removeWhitespace + outerHTML dont remove meaningless white-spaces inside start and end tags' , function ( ) {
5
+ const html = `<!DOCTYPE html
6
+ ><html lang="en"
7
+ ><meta charset="UTF-8"
8
+ ><title>test</title
9
+
10
+ ><p>test</p
11
+
12
+ ></html>` ;
13
+ const root = parse ( html ) ;
14
+ const el = root . querySelector ( 'html' ) . removeWhitespace ( ) ;
15
+ el . outerHTML . should . eql ( '<html lang="en"><meta charset="UTF-8"><title>test</title><p>test</p></html>' ) ;
16
+ } ) ;
17
+ } ) ;
Original file line number Diff line number Diff line change 29
29
"inlineSources" : false ,
30
30
"isolatedModules" : false ,
31
31
"lib" : [
32
- " esnext"
32
+ " esnext" ,
33
+ " dom"
33
34
],
34
35
"listFiles" : false ,
35
36
"listEmittedFiles" : false ,
You can’t perform that action at this time.
0 commit comments