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 = "") {
const parsed = new DOMParser().parseFromString(svgText, "image/svg+xml");
const error = parsed.querySelector("parsererror");
if (error) {
throw new Error(error.textContent.trim());
}
const svg = document.importNode(parsed.documentElement, true);
const template = document.createElement("template");
template.innerHTML = svgText;
const svg = document.adoptNode(template.content.firstElementChild);
prefixSVGIds(svg, prefix);
return svg;
}