File tree Expand file tree Collapse file tree
test/configCases/html/minimize-corrupt-tags Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8328,7 +8328,18 @@ const printer = (path, writer) => {
83288328 value !== "" &&
83298329 ! / [ \s " ' ` = < > ] / . test ( value )
83308330 ) {
8331- attrString = `${ name } =${ value } ` ;
8331+ let nextChar = "" ;
8332+ if ( attr . valueStart !== - 1 ) {
8333+ const quote = _htmlSource [ attr . valueStart - 1 ] ;
8334+ const attrEnd =
8335+ quote === '"' || quote === "'"
8336+ ? attr . valueEnd + 1
8337+ : attr . valueEnd ;
8338+ nextChar = _htmlSource [ attrEnd ] ;
8339+ }
8340+ if ( nextChar !== "/" ) {
8341+ attrString = `${ name } =${ value } ` ;
8342+ }
83328343 }
83338344
83348345 if ( attrString !== null ) {
Original file line number Diff line number Diff line change 11import "./page.html" ;
2-
3- it ( "should safely minify emitted HTML when optimization.minimize is enabled" , ( ) => {
4- // The assertions on the emitted file live in test.config.js (afterExecute),
5- // this keeps a runnable entry so the chunk (and its `.html`) is produced.
2+ it ( "should handle minification with cloned and merged attributes" , ( ) => {
63 expect ( true ) . toBe ( true ) ;
74} ) ;
Original file line number Diff line number Diff line change 66< body class ="test2 " data-bool disabled >
77<!-- Adoption agency clones -->
88< b > < i > < s > < u > < p > test</ p > </ b > </ u > </ s > </ i >
9+ <!-- Void tag with unquoted attr slash issue -->
10+ < input type ="text "/>
11+ < input type ="text " />
912</ body >
1013</ html >
Original file line number Diff line number Diff line change @@ -26,5 +26,13 @@ module.exports = {
2626 } `
2727 ) ;
2828 }
29+ if ( ! html . includes ( '<input type="text"/>' ) ) {
30+ throw new Error (
31+ `Self-closing void tag without space broke. HTML: ${ html } `
32+ ) ;
33+ }
34+ if ( ! html . includes ( "<input type=text />" ) ) {
35+ throw new Error ( `Self-closing void tag with space broke. HTML: ${ html } ` ) ;
36+ }
2937 }
3038} ;
You can’t perform that action at this time.
0 commit comments