|
@@ -132,8 +132,7 @@ this.htmlMinifier = this.htmlMinifier || (() => {
|
|
|
removeEmptyAttributes,
|
|
removeEmptyAttributes,
|
|
|
removeRedundantAttributes,
|
|
removeRedundantAttributes,
|
|
|
compressJSONLD,
|
|
compressJSONLD,
|
|
|
- node => mergeElements(node, "style", (node, previousSibling) => node.parentElement && node.parentElement.tagName == "HEAD" && node.media == previousSibling.media && node.title == previousSibling.title),
|
|
|
|
|
- node => mergeElements(node, "script", (node, previousSibling) => node.parentElement && node.parentElement.tagName == "HEAD" && ((!node.type || node.nodeType == "text/javascript") && (!previousSibling.type || previousSibling.nodeType == "text/javascript")))
|
|
|
|
|
|
|
+ node => mergeElements(node, "style", (node, previousSibling) => node.parentElement && node.parentElement.tagName == "HEAD" && node.media == previousSibling.media && node.title == previousSibling.title)
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
@@ -255,7 +254,7 @@ this.htmlMinifier = this.htmlMinifier || (() => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function removeEmptyInlineElements(doc) {
|
|
function removeEmptyInlineElements(doc) {
|
|
|
- doc.querySelectorAll("style, script, noscript").forEach(element => {
|
|
|
|
|
|
|
+ doc.querySelectorAll("style, script:not([src]), noscript").forEach(element => {
|
|
|
if (!element.textContent.trim()) {
|
|
if (!element.textContent.trim()) {
|
|
|
element.remove();
|
|
element.remove();
|
|
|
}
|
|
}
|