|
@@ -416,9 +416,13 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
cleanup() {
|
|
cleanup() {
|
|
|
|
|
+ const metaCharset = this.doc.head.querySelector("meta[charset]");
|
|
|
|
|
+ if (metaCharset) {
|
|
|
|
|
+ this.doc.head.insertBefore(metaCharset, this.doc.head.firstChild);
|
|
|
|
|
+ }
|
|
|
this.doc.querySelectorAll("style[data-single-file-sheet]").forEach(element => element.removeAttribute("data-single-file-sheet"));
|
|
this.doc.querySelectorAll("style[data-single-file-sheet]").forEach(element => element.removeAttribute("data-single-file-sheet"));
|
|
|
this.doc.querySelectorAll("base").forEach(element => element.remove());
|
|
this.doc.querySelectorAll("base").forEach(element => element.remove());
|
|
|
- if (this.doc.head.querySelectorAll("*").length == 1 && this.doc.head.querySelector("meta[charset]") && this.doc.body.childNodes.length == 0) {
|
|
|
|
|
|
|
+ if (this.doc.head.querySelectorAll("*").length == 1 && metaCharset && this.doc.body.childNodes.length == 0) {
|
|
|
this.doc.head.querySelector("meta[charset]").remove();
|
|
this.doc.head.querySelector("meta[charset]").remove();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|