Q: What's driving this — contributing full Shadow DOM support upstream to HtmlUnit itself, or just getting HtmlUnit(Driver) far enough to test your own shadow-DOM-based pages?
A: Upstream contribution to HtmlUnit/htmlunitQ: How much of the spec actually matters for your use case?
A: Full spec: closed mode, CSS encapsulation, event retargeting, declarative shadow DOM
Good — that confirms the scope. A few more things worth knowing before any code gets written:
DomNode.querySelector()(the core query engine, ~2200 lines) has no shadow-boundary awareness — it would need to become shadow-tree-scoped by default, with an explicit "deep" path for things likegetElementByIdsemantics across the tree.- The CSS engine isn't part of HtmlUnit itself — it's
htmlunit-cssparser, a separate library, also maintained by Ronald Brill (rbri), same for the HTML parser (neko-htmlunit). Full CSS encapsulation (:host,:host(),::slotted, and correctly not leaking outer-page styles into the sha