mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
This commit is contained in:
1 parent
f3577afd22
commit
89b8b183a0
1 file changed
+3
-6
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user