It is impossible currently, as WASM only allows for compute, everything else relies on the host, and exported functions to be called by the WASM code.
There are some plans to support DOM directly from WASM, but at the pace Webassembly features get into the browsers, it is years away if it ever gets done.
There are some plans to support DOM directly from WASM, but at the pace Webassembly features get into the browsers, it is years away if it ever gets done.