|
|
@@ -578,19 +578,15 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
|
|
|
resolveHrefs() {
|
|
|
this.doc.querySelectorAll("[href]").forEach(element => {
|
|
|
- if (element.getAttribute("href")) {
|
|
|
- const href = element.getAttribute("href");
|
|
|
- if (href) {
|
|
|
- if (!DomUtil.testIgnoredPath(href) && DomUtil.testValidPath(href, this.baseURI, this.options.url)) {
|
|
|
- const normalizedHref = DomUtil.normalizeURL(href);
|
|
|
- if (element.tagName == "LINK" || normalizedHref == href) {
|
|
|
- try {
|
|
|
- element.setAttribute("href", new URL(href, this.options.baseURI || this.options.url));
|
|
|
- } catch (error) {
|
|
|
- if (element.tagName == "LINK") {
|
|
|
- element.setAttribute("href", EMPTY_URL);
|
|
|
- }
|
|
|
- }
|
|
|
+ const href = element.getAttribute("href");
|
|
|
+ if (href && !DomUtil.testIgnoredPath(href) && DomUtil.testValidPath(href, this.baseURI, this.options.url)) {
|
|
|
+ const normalizedHref = DomUtil.normalizeURL(href);
|
|
|
+ if (element.tagName == "LINK" || normalizedHref == href) {
|
|
|
+ try {
|
|
|
+ element.setAttribute("href", new URL(href, this.options.baseURI || this.options.url));
|
|
|
+ } catch (error) {
|
|
|
+ if (element.tagName == "LINK") {
|
|
|
+ element.setAttribute("href", EMPTY_URL);
|
|
|
}
|
|
|
}
|
|
|
}
|