html-minifier-next 4.12.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -347,9 +347,9 @@ If you have chunks of markup you would like preserved, you can wrap them with `<
|
|
|
347
347
|
|
|
348
348
|
You can minify `script` elements with JSON-LD by setting `{ processScripts: ['application/ld+json'] }`. Note that this minification is rudimentary; it’s mainly useful for removing newlines and excessive whitespace.
|
|
349
349
|
|
|
350
|
-
### Preserving SVG elements
|
|
350
|
+
### Preserving SVG and MathML elements
|
|
351
351
|
|
|
352
|
-
SVG elements are automatically recognized, and when they are minified, both case-sensitivity and closing
|
|
352
|
+
SVG and MathML elements are automatically recognized as foreign elements, and when they are minified, both case-sensitivity and self-closing slashes are preserved, regardless of the minification settings used for the rest of the file. This ensures valid output for these namespaced elements.
|
|
353
353
|
|
|
354
354
|
### Working with invalid or partial markup
|
|
355
355
|
|
package/dist/htmlminifier.cjs
CHANGED
|
@@ -2815,7 +2815,8 @@ async function minifyHTML(value, options, partialMarkup) {
|
|
|
2815
2815
|
wantsNextTag: !!(options.collapseWhitespace || options.collapseInlineTagWhitespace || options.conservativeCollapse),
|
|
2816
2816
|
|
|
2817
2817
|
start: async function (tag, attrs, unary, unarySlash, autoGenerated) {
|
|
2818
|
-
|
|
2818
|
+
const lowerTag = tag.toLowerCase();
|
|
2819
|
+
if (lowerTag === 'svg' || lowerTag === 'math') {
|
|
2819
2820
|
options = Object.create(options);
|
|
2820
2821
|
options.caseSensitive = true;
|
|
2821
2822
|
options.keepClosingSlash = true;
|
|
@@ -2901,7 +2902,8 @@ async function minifyHTML(value, options, partialMarkup) {
|
|
|
2901
2902
|
}
|
|
2902
2903
|
},
|
|
2903
2904
|
end: function (tag, attrs, autoGenerated) {
|
|
2904
|
-
|
|
2905
|
+
const lowerTag = tag.toLowerCase();
|
|
2906
|
+
if (lowerTag === 'svg' || lowerTag === 'math') {
|
|
2905
2907
|
options = Object.getPrototypeOf(options);
|
|
2906
2908
|
}
|
|
2907
2909
|
tag = options.name(tag);
|
|
@@ -7957,7 +7957,8 @@ async function minifyHTML(value, options, partialMarkup) {
|
|
|
7957
7957
|
wantsNextTag: !!(options.collapseWhitespace || options.collapseInlineTagWhitespace || options.conservativeCollapse),
|
|
7958
7958
|
|
|
7959
7959
|
start: async function (tag, attrs, unary, unarySlash, autoGenerated) {
|
|
7960
|
-
|
|
7960
|
+
const lowerTag = tag.toLowerCase();
|
|
7961
|
+
if (lowerTag === 'svg' || lowerTag === 'math') {
|
|
7961
7962
|
options = Object.create(options);
|
|
7962
7963
|
options.caseSensitive = true;
|
|
7963
7964
|
options.keepClosingSlash = true;
|
|
@@ -8043,7 +8044,8 @@ async function minifyHTML(value, options, partialMarkup) {
|
|
|
8043
8044
|
}
|
|
8044
8045
|
},
|
|
8045
8046
|
end: function (tag, attrs, autoGenerated) {
|
|
8046
|
-
|
|
8047
|
+
const lowerTag = tag.toLowerCase();
|
|
8048
|
+
if (lowerTag === 'svg' || lowerTag === 'math') {
|
|
8047
8049
|
options = Object.getPrototypeOf(options);
|
|
8048
8050
|
}
|
|
8049
8051
|
tag = options.name(tag);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"htmlminifier.d.ts","sourceRoot":"","sources":["../../src/htmlminifier.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"htmlminifier.d.ts","sourceRoot":"","sources":["../../src/htmlminifier.js"],"names":[],"mappings":"AA26EO,8BAJI,MAAM,YACN,eAAe,GACb,OAAO,CAAC,MAAM,CAAC,CAQ3B;;;;;;;;;;;;UAl5ES,MAAM;YACN,MAAM;YACN,MAAM;mBACN,MAAM;iBACN,MAAM;kBACN,MAAM;;;;;;;;;;;;;4BAQN,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,qBAAqB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,KAAK,OAAO;;;;;;;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MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;;;;;;;;WAS7F,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;;;;;;;+BAOxB,OAAO;;;;;;;;;;oBAMP,OAAO;;;;;;;;yBASP,OAAO;;;;;;;gCAOP,OAAO;;;;;;;;iCAMP,OAAO;;;;;;;;;;qBAOP,MAAM,EAAE;;;;;;;qBASR,IAAI,GAAG,GAAG;;;;;;;4BAMV,OAAO;;;;;;;;qBAMP,OAAO;;;;;;;;;4BAOP,OAAO,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;;;;;;;;0BAQtD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;gCAOP,MAAM,EAAE;;;;;;;;yBAyBR,OAAO;;;;;;;;gCAOP,OAAO;;;;;;;iCAOP,OAAO;;;;;;;oCAMP,OAAO;;;;;;;;;;0BAMP,OAAO;;;;;;;;;qBASP,OAAO,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;;;;;;;;;oBAQzD,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;;;;;;;;0BAQrC,OAAO;;;;;;;sBAOP,OAAO;;wBA3YkC,cAAc;0BAAd,cAAc;+BAAd,cAAc"}
|
package/package.json
CHANGED
package/src/htmlminifier.js
CHANGED
|
@@ -2011,7 +2011,8 @@ async function minifyHTML(value, options, partialMarkup) {
|
|
|
2011
2011
|
wantsNextTag: !!(options.collapseWhitespace || options.collapseInlineTagWhitespace || options.conservativeCollapse),
|
|
2012
2012
|
|
|
2013
2013
|
start: async function (tag, attrs, unary, unarySlash, autoGenerated) {
|
|
2014
|
-
|
|
2014
|
+
const lowerTag = tag.toLowerCase();
|
|
2015
|
+
if (lowerTag === 'svg' || lowerTag === 'math') {
|
|
2015
2016
|
options = Object.create(options);
|
|
2016
2017
|
options.caseSensitive = true;
|
|
2017
2018
|
options.keepClosingSlash = true;
|
|
@@ -2097,7 +2098,8 @@ async function minifyHTML(value, options, partialMarkup) {
|
|
|
2097
2098
|
}
|
|
2098
2099
|
},
|
|
2099
2100
|
end: function (tag, attrs, autoGenerated) {
|
|
2100
|
-
|
|
2101
|
+
const lowerTag = tag.toLowerCase();
|
|
2102
|
+
if (lowerTag === 'svg' || lowerTag === 'math') {
|
|
2101
2103
|
options = Object.getPrototypeOf(options);
|
|
2102
2104
|
}
|
|
2103
2105
|
tag = options.name(tag);
|