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.