소스 검색

fixed SVG href handling

Gildas 7 년 전
부모
커밋
40800f2e01
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  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);
+					}
 				}
 			});
 		}