|
|
@@ -149,6 +149,7 @@ this.SingleFileCore = (() => {
|
|
|
await this.processor.htmlImports();
|
|
|
}
|
|
|
this.processor.removeEmptyInlineElements();
|
|
|
+ this.processor.removeBase();
|
|
|
}
|
|
|
|
|
|
getPageData() {
|
|
|
@@ -313,6 +314,10 @@ this.SingleFileCore = (() => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ removeBase() {
|
|
|
+ this.doc.querySelectorAll("base").forEach(element => element.remove());
|
|
|
+ }
|
|
|
+
|
|
|
removeScripts() {
|
|
|
this.doc.querySelectorAll("script:not([type=\"application/ld+json\"])").forEach(element => element.remove());
|
|
|
}
|
|
|
@@ -344,7 +349,12 @@ this.SingleFileCore = (() => {
|
|
|
}
|
|
|
|
|
|
resolveHrefs() {
|
|
|
- this.doc.querySelectorAll("[href]").forEach(element => element.setAttribute("href", element.href));
|
|
|
+ this.doc.querySelectorAll("[href]").forEach(element => {
|
|
|
+ const match = element.href && element.href.match(/(.*)#.*$/);
|
|
|
+ if (!match || match[1] != this.baseURI) {
|
|
|
+ element.setAttribute("href", element.href);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
removeUnusedCSSRules() {
|