You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/zrender/lib/tool/parseXML.js

16 lines
449 B

import { isString } from '../core/util.js';
export function parseXML(svg) {
if (isString(svg)) {
var parser = new DOMParser();
svg = parser.parseFromString(svg, 'text/xml');
}
var svgNode = svg;
if (svgNode.nodeType === 9) {
svgNode = svgNode.firstChild;
}
while (svgNode.nodeName.toLowerCase() !== 'svg' || svgNode.nodeType !== 1) {
svgNode = svgNode.nextSibling;
}
return svgNode;
}