From 74b6b0ac93f3a75be6bf967528e225eee35a425c Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Sun, 13 Sep 2026 20:45:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=89=8D=E7=AB=AF=E7=95=8C=E9=9D=A2):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96SVG=E8=B5=84=E6=BA=90=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/webui/ofdgo.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/assets/webui/ofdgo.js b/assets/webui/ofdgo.js index 0a58b40..1baf76b 100644 --- a/assets/webui/ofdgo.js +++ b/assets/webui/ofdgo.js @@ -1991,9 +1991,6 @@ function prefixSVGIds(svg, prefix) { return; } const replaceRef = (value) => { - if (!value) { - return value; - } let next = value.replace(/url\(#([^)]+)\)/g, (match, id) => { const mapped = idMap.get(id); return mapped ? `url(#${mapped})` : match; @@ -2007,10 +2004,15 @@ function prefixSVGIds(svg, prefix) { return next; }; const attrs = ["clip-path", "fill", "filter", "href", "marker-end", "marker-mid", "marker-start", "mask", "stroke", "style", "xlink:href"]; - for (const node of svg.querySelectorAll("*")) { - for (const attr of attrs) { - if (node.hasAttribute(attr)) { - node.setAttribute(attr, replaceRef(node.getAttribute(attr))); + for (const attr of attrs) { + for (const node of svg.querySelectorAll(`[${attr === "xlink:href" ? "*|href" : attr}*="#"]`)) { + const value = node.getAttribute(attr); + if (!value) { + continue; + } + const next = replaceRef(value); + if (next !== value) { + node.setAttribute(attr, next); } } }