Browse Source

fixed SVG href handling

Gildas 7 năm trước cách đây
mục cha
commit
40800f2e01
1 tập tin đã thay đổi với 6 bổ sung3 xóa
  1. 6 3
      lib/single-file/single-file-core.js

+ 6 - 3
lib/single-file/single-file-core.js

@@ -377,9 +377,12 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 
 		resolveHrefs() {
 			this.doc.querySelectorAll("[href]").forEach(element => {
-				const match = element.href && element.href.match(/(.*)#.*$/);
-				if (!match || match[1] != this.baseURI) {
-					element.setAttribute("href", element.href);
+				if (element.href) {
+					const href = element.href.baseVal ? element.href.baseVal : element.href;
+					const match = href.match(/(.*)#.*$/);
+					if (!match || match[1] != this.baseURI) {
+						element.setAttribute("href", href);
+					}
 				}
 			});
 		}