logoalt Hacker News

dcchambersyesterday at 7:41 PM2 repliesview on HN

> Direct DOM access doesn't make any sense as a WASM feature.

I disagree. The idea of doing DOM manipulation in a language that is not Javascript was *the main reason* I was ever excited about WASM.


Replies

afioritoday at 4:50 AM

You can't even run wasm in browsers without JavaScript, it is not a supported <script /> type

Anyway I am quite sure that you could almost completely get rid of js glue code by importing the static Reflect methods and a few functions like (a,b)=>a+b for the various operators, add a single array/object References to hold refs and you can do pretty much everything from wasm by mixing imported calls

flohofwoeyesterday at 7:45 PM

> The idea of doing DOM manipulation in a language that is not Javascript

...is already possible, see for instance:

https://rustwasm.github.io/docs/wasm-bindgen/examples/dom.ht...

You don't need to write Javascript to access the DOM. Such bindings still call JS under the hood of course to access the DOM API, but that's an implementation detail which isn't really important for the library user.

show 3 replies