瀏覽代碼

fixed issue when the ID is already used in the document

Gildas 7 年之前
父節點
當前提交
8f8b635f3c
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/single-file/single-file-core.js

+ 1 - 1
lib/single-file/single-file-core.js

@@ -1088,7 +1088,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 									const symbolElement = svgDoc.querySelector(hashMatch[0]);
 									if (symbolElement) {
 										resourceElement.setAttribute(attributeName, hashMatch[0]);
-										resourceElement.parentElement.appendChild(symbolElement);
+										resourceElement.parentElement.insertBefore(symbolElement, resourceElement.parentElement.firstChild);
 									}
 								} else {
 									resourceElement.setAttribute(attributeName, "data:image/svg+xml," + content);