Hacker News new | ask | show | jobs
by andersrs 1067 days 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.
1 comments

The 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

Thanks 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.