parse svg string and use it like dom
npm install svg-vdomThis is a util that parses SVG strings and uses DOM-like APIs to manipulate them.
Install from npm
```
npm install svg-vdom -D
Install from yarn
``
yarn add svg-vdom -D
Use
`js
import { parse, NodeType } from 'svg-vdom';
parse().then(vdom => {``
console.log(vdom.childNodes.length); // 2
console.log(vdom.querySelector('#Page-1')); // g#Page-1
console.log(NodeType[vdom.nodeType]); // 'Document'
console.log(vdom.toString());
});
Name | Description
---- | ----
parse | Parse the SVG string to generate virtual-dom
NodeType | Enum object of node type
ParentNode | The class of the container node
TextNode | The class of the text node
TagNode | The class of the label node
stringifySVG | Stringify virtual-dom
stringifyNode | Stringify a node
stringifyTag | Stringify a tag node
parseSelector | Parse the selector string
selectorUnitCombinator | CSS selector combo symbol enumeration object
attrModifier | CSS attribute selector equal sign enumeration object
matchSelectorGroups | Determine whether a node matches the CSS selector group
matchSelectors | Determine whether a node matches the CSS selector
matchSelector | Determine whether a node matches the CSS selector unit