feat(前端界面): 优化SVG解析性能,减少页面加载与翻页卡顿
build.yaml / build (push) Successful in 36s

This commit is contained in:
xiaoqidun committed 2026-09-12 01:37:09 +08:00
1 parent f3577afd22
commit 89b8b183a0
1 file changed
+3 -6
+3 -6
View File
@@ -1734,12 +1734,9 @@ function layoutPageShell(shell, page) {
} }
function parseSVG(svgText, prefix = "") { function parseSVG(svgText, prefix = "") {
const parsed = new DOMParser().parseFromString(svgText, "image/svg+xml"); const template = document.createElement("template");
const error = parsed.querySelector("parsererror"); template.innerHTML = svgText;
if (error) { const svg = document.adoptNode(template.content.firstElementChild);
throw new Error(error.textContent.trim());
}
const svg = document.importNode(parsed.documentElement, true);
prefixSVGIds(svg, prefix); prefixSVGIds(svg, prefix);
return svg; return svg;
} }