|
|
@@ -148,7 +148,9 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
if (!this.options.removeImports) {
|
|
|
await this.processor.htmlImports();
|
|
|
}
|
|
|
- this.processor.removeEmptyInlineElements();
|
|
|
+ if (this.options.compressHTML) {
|
|
|
+ this.processor.compressHTML(true);
|
|
|
+ }
|
|
|
this.processor.removeBase();
|
|
|
}
|
|
|
|
|
|
@@ -311,14 +313,6 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- removeEmptyInlineElements() {
|
|
|
- this.doc.querySelectorAll("style, script").forEach(element => {
|
|
|
- if (element.textContent.trim() == "") {
|
|
|
- element.remove();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
removeBase() {
|
|
|
this.doc.querySelectorAll("base").forEach(element => element.remove());
|
|
|
}
|
|
|
@@ -379,8 +373,12 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
this.doc.querySelectorAll("[" + REMOVED_CONTENT_ATTRIBUTE_NAME + "]").forEach(element => element.remove());
|
|
|
}
|
|
|
|
|
|
- compressHTML() {
|
|
|
- this.dom.htmlnano(this.doc);
|
|
|
+ compressHTML(postProcess) {
|
|
|
+ if (postProcess) {
|
|
|
+ this.dom.htmlnano.postProcess(this.doc);
|
|
|
+ } else {
|
|
|
+ this.dom.htmlnano.process(this.doc);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
insertSingleFileCommentNode() {
|