The same DOM API could be exposed directly to WASM via WASI-like calls, without going through Javascript.