Hacker News new | ask | show | jobs
by Klathmon 3836 days ago
In the current proposal there is no way for WebAssembly to directly access the DOM (or any other "Web API" objects).

Basically you will need to drop back down into javascript and handle that there (basically how asm.js does it now).

But there is a proposal to eventually integrate direct DOM access into Web Assembly, but that's for after they get it up and running.

1 comments

If they wanted to do it right, then an HTTP requests itself should serve a compiled HTML binary based on an AST. The binary version of HTML.
I would consider that the worst scenario. If each website was its own binary application it would undo the open source aspect of websites (even though that's only partly true today due to all the obscured javascript). But maybe that would actually be desirable for all companies which rely on advertising revenue and want to prevent any modification of their web content (such as removal of ads). It'll be interesting to see how the web develops in the future. WebAssembly definitely seems to give more control to the author.
Just because it's a binary AST doesn't mean it's closed.
If you are using the XHTML syntax, you could send it in a binary XML format such as Efficient XML Interchange (EXI). (Never seen anyone actually do this of course, since browsers don't support it; not sure if it is a good idea either - would it really be much faster than just say GZIP, sufficiently so to justify the extra complexity?)