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.
16 lines
449 B
16 lines
449 B
1 month ago
|
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;
|
||
|
}
|