|
|
@@ -148,6 +148,7 @@ this.SingleFileCore = (() => {
|
|
|
if (!this.options.removeImports) {
|
|
|
await this.processor.htmlImports();
|
|
|
}
|
|
|
+ this.processor.removeEmptyInlineElements();
|
|
|
}
|
|
|
|
|
|
getPageData() {
|
|
|
@@ -304,6 +305,14 @@ this.SingleFileCore = (() => {
|
|
|
this.doc.querySelectorAll("audio[src], audio > source[src], video[src], video > source[src]").forEach(element => element.removeAttribute("src"));
|
|
|
}
|
|
|
|
|
|
+ removeEmptyInlineElements() {
|
|
|
+ this.doc.querySelectorAll("style, script").forEach(element => {
|
|
|
+ if (element.textContent.trim() == "") {
|
|
|
+ element.remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
removeScripts() {
|
|
|
this.doc.querySelectorAll("script:not([type=\"application/ld+json\"])").forEach(element => element.remove());
|
|
|
}
|