3 ms·
Does code written in WebAssembly have access to the DOM somehow? How will that work?
by wilg 11y ago
Does code written in WebAssembly have access to the DOM somehow? How will that work?
- Klathmon 11y agoIn 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.
- mozumder 11y agoIf 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.
- deleted 11y ago[deleted]
- jcfrei 11y agoI 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.
- mozumder 11y agoJust because it's a binary AST doesn't mean it's closed.
- skissane 11y agoIf 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?)
- kevingadd 11y agoIn asm.js currently the way you'd access the DOM is through a JS glue layer that manages GC objects and makes DOM calls. The same applies here.