فهرست منبع

minor refactoring

Gildas 7 سال پیش
والد
کامیت
c32a6a6df6
1فایلهای تغییر یافته به همراه9 افزوده شده و 13 حذف شده
  1. 9 13
      lib/single-file/single-file-core.js

+ 9 - 13
lib/single-file/single-file-core.js

@@ -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);
 							}
 						}
 					}