mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 15:06:46 +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 = "") {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user