3 ms·
Does Bun have a built-in DOM Parser? In Nodejs it's horrendously slow using JSDOM and Linkedom is a great effort but still about 20x slower than a browser. Keep
by andersrs 3y ago
Does Bun have a built-in DOM Parser? In Nodejs it's horrendously slow using JSDOM and Linkedom is a great effort but still about 20x slower than a browser. Keep up the good work Jarred.
- Jarred 3y agoThe closest thing we have builtin is HTMLRewriter, which is more of a tool for transforming HTML than for traversing. I have looked a bunch of times at how hard it’d be to import the DOM APIs from WebKit/Safari and would really love to if it didn’t also mean pulling in most of a web browser I think happy-dom is good for DOM-like testing though. https://bun.sh/docs/test/dom https://bun.sh/docs/test/dom
- andersrs 3y agoThanks HTMLRewriter actually fits my use case perfectly. I don't need canvas and complicated stuff like that. Just the ability to parse some html and strip out certain things.