Replies: 1 comment
|
There is no NodeList drop-in. import * as cheerio from 'cheerio'
const $ = cheerio.load(svg, { xml: true }) // SVG is XML
const paths = $(element).find('path') // analog of element.querySelectorAll('path')
const nodes = paths.toArray() // raw nodes, not a NodeListUse the collection (
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I am working on updating a common JS module to run server side in node and node-RED. It has some calls to element.querySelectorAll() in parsing xml elements of svg paths mostly, and I found cheeriojs in hopes of a drop-in replacement.
I have had some runtime success in replacing the browser side queries with the cheerio query, but the return string is in a different format. I saw some mention of maybe using nodelist after, but I am not sure that is the proper approach. Anybody have any examples of using cheeriojs as a drop-in replacement for the element.querySelectorAll()?
Thanks for any help!
All reactions