@@ -1107,6 +1107,12 @@ test('removing javascript type attributes', async () => {
1107
1107
output = '<script>alert(1)</script>' ;
1108
1108
expect ( await minify ( input , { removeScriptTypeAttributes : true } ) ) . toBe ( output ) ;
1109
1109
1110
+ // https://github.com/terser/html-minifier-terser/issues/132
1111
+ input = '<script type>alert(1)</script>' ;
1112
+ expect ( await minify ( input , { removeScriptTypeAttributes : false } ) ) . toBe ( input ) ;
1113
+ output = '<script>alert(1)</script>' ;
1114
+ expect ( await minify ( input , { removeScriptTypeAttributes : true } ) ) . toBe ( output ) ;
1115
+
1110
1116
input = '<script type="modules">alert(1)</script>' ;
1111
1117
expect ( await minify ( input , { removeScriptTypeAttributes : false } ) ) . toBe ( input ) ;
1112
1118
output = '<script type="modules">alert(1)</script>' ;
@@ -1138,6 +1144,12 @@ test('removing type="text/css" attributes', async () => {
1138
1144
output = '<style>.foo { color: red }</style>' ;
1139
1145
expect ( await minify ( input , { removeStyleLinkTypeAttributes : true } ) ) . toBe ( output ) ;
1140
1146
1147
+ // https://github.com/terser/html-minifier-terser/issues/132
1148
+ input = '<style type>.foo { color: red }</style>' ;
1149
+ expect ( await minify ( input , { removeStyleLinkTypeAttributes : false } ) ) . toBe ( input ) ;
1150
+ output = '<style>.foo { color: red }</style>' ;
1151
+ expect ( await minify ( input , { removeStyleLinkTypeAttributes : true } ) ) . toBe ( output ) ;
1152
+
1141
1153
input = '<style type="text/css">.foo { color: red }</style>' ;
1142
1154
expect ( await minify ( input , { removeStyleLinkTypeAttributes : false } ) ) . toBe ( input ) ;
1143
1155
output = '<style>.foo { color: red }</style>' ;
@@ -1154,6 +1166,11 @@ test('removing type="text/css" attributes', async () => {
1154
1166
output = '<link rel="stylesheet" href="http://example.com">' ;
1155
1167
expect ( await minify ( input , { removeStyleLinkTypeAttributes : true } ) ) . toBe ( output ) ;
1156
1168
1169
+ // https://github.com/terser/html-minifier-terser/issues/132
1170
+ input = '<link rel="stylesheet" type href="http://example.com">' ;
1171
+ output = '<link rel="stylesheet" href="http://example.com">' ;
1172
+ expect ( await minify ( input , { removeStyleLinkTypeAttributes : true } ) ) . toBe ( output ) ;
1173
+
1157
1174
input = '<link rel="alternate" type="application/atom+xml" href="data.xml">' ;
1158
1175
expect ( await minify ( input , { removeStyleLinkTypeAttributes : true } ) ) . toBe ( input ) ;
1159
1176
} ) ;
0 commit comments