UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

17 lines (16 loc) 432 B
import { isString } from "../core/util.mjs"; 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; } export { parseXML };