svgson
svgson copied to clipboard
Querying with selectors?
Before I write something myself, is there an existing library somewhere to query the svgson tree using CSS-like selectors?
Example:
const rects = querySelector('#namedGroup rect')
rects.forEach(rect => {
rect.attributes.fill = 'red'
})
Hi @bgmort, thanks for open the Issue.
Don't know, but super curious on what you build over in that case!
@bgmort
If you are in a Browser environment, you can use DOMParser to do exactly what you're asking.
If you are in a NodeJS environment, you can accomplish the same using jsdom.
@LiamAttClarke thank you! I don't remember what I was wanting to do with it back in August, but that's good info to have.