July 2, 2025Volume 23, issue 3 PDF When Is WebAssembly Going to Get DOM Support? Or, how I learned to stop worrying and love glue code Daniel Ehrenberg Is WebAssembly (Wasm) really ready for production usage in web applications, even though that usage requires integration with a web page and the APIs used to manipulate it, such as the DOM? Simultaneously, the answer to this question is that "Wasm might never get direct DOM access," and "Yes, Wasm is ready for all kinds of web-integrated uses, having supported calling out to the DOM (with a little indirection) since day zero." Let me explain. WebAssembly was designed from its outset to have a strict separation from JavaScript. Unlike asm.js (developer.mozilla.org), which is unavoidably embedded in JavaScript, the core Wasm bytecode format is completely clean of all the "legacy" of JavaScript. At the same time, it says it right in the name—Wasm is part of the web platform. So, why are web APIs like the DOM still tied to JavaScript, and why are there no new Wasm versions? The answer is that new versions of web APIs, such as the DOM, are not needed to make them usable from Wasm; the existing JavaScript APIs work just fine. When used in the browser or other JavaScript environments, Wasm includes various JavaScript APIs that allow compiler-generated glue code to provide seamless access to any JavaScript code. WebAssembly has been progressively evolving toward allowing build toolchains to emit less code, specifically less JavaScript. These improvements target the code that makes real web applications slow and bulky in Wasm. Wasm's integration with JavaScript will continue to evolve and deepen through the work of the W3C Wasm CG (Community Group). Maybe, if it turns out to cause performance and code-size improvements to justify its complexity, a mechanism could be added in the future to call web APIs straight from Wasm, but this mechanism would require tremendous effort to design and implement. On the other hand, a bit of J...
First seen: 2025-07-23 06:53
Last seen: 2025-07-23 15:55