News for hackers. Stuff that matters.
Re:Asm-dom, a minimal WebAssembly virtual DOM to build C++ SPA by helltone on Monday March 16, 2020 @05:24AM (#22591211)
What is a virtual DOM, and can we have SPA without it?
Re:Asm-dom, a minimal WebAssembly virtual DOM to build C++ SPA by SysINT on Monday March 16, 2020 @08:11AM (#22591992)
Yes, however it is important to know one will loose accessibility for people using assistive technologies. For background try W3C's Web Accessibility Initiative (WAI) Accessible Rich Internet Applications (WAI-ARIA) https://www.w3.org/WAI/standards-guidelines/aria/
Re:Asm-dom, a minimal WebAssembly virtual DOM to build C++ SPA by danShumway on Monday March 16, 2020 @08:44AM (#22592176)
This is a bit misleading; you're losing accessibility only if you're never rendering to the actual DOM. A virtual DOM is just a way to avoid interacting with the real DOM until the last second, it doesn't really have anything to do with your final render target.

Svette avoids a virtual DOM while still rendering to the real DOM. It keeps itself fast by compiling your code to optimize unnecessary operations beforehand. Svette can still be used for accessible web apps.

JQuery and pure Javascript just manipulate the real DOM. This can come with performance consequences, but for many apps, the performance consequences don't matter. JQuery/Javascript can still be accessible.

React/Preact/etc... all use a virtual DOM. They can be accessible as well.

The virtual DOM is not the thing that gives you accessibility. You could have a virtual DOM that rendered to canvas and it would not meet accessibility standards. Accessibility is determined by your final render target, not by how you get there.

Re:Asm-dom, a minimal WebAssembly virtual DOM to build C++ SPA by zelly on Monday March 16, 2020 @08:49AM (#22592210)
I understand WAI for articles and "document" web pages, but does anyone who uses these technologies use them on web apps? Is this even remotely the audience for most of these SaaS SPAs?
Re:Asm-dom, a minimal WebAssembly virtual DOM to build C++ SPA by danShumway on Monday March 16, 2020 @09:17AM (#22592373)
Ideally we'd like SaaS SPAs to be as accessible (if not more accessible) than articles/documents.

The WAI looks mostly aimed at applications anyway, I suspect in part because there aren't a ton of compelling reasons to use WASM for a static page.

Re:Asm-dom, a minimal WebAssembly virtual DOM to build C++ SPA by hencoappel on Monday March 16, 2020 @06:21AM (#22591446)
As already stated, the idea is that you have an object that represents your DOM. When your code makes changes to the DOM, it actually affects the virtual DOM, this allows for lots of quick changes to the vDOM without much overhead, then at some point the vDom is synchronised with the actual DOM. This reduces the overhead between wasm->JS as you don't have to do it as often, it also can improve the performance as DOM changes can be slow.
Re:Asm-dom, a minimal WebAssembly virtual DOM to build C++ SPA by raidicy on Monday March 16, 2020 @05:49AM (#22591310)
A virtual DOM is a copy of the DOM that is usually diffed and updated based on the differences.

> can we have SPA without it? Yes. You can set divs to be visiable/hidden based on routing with vanilla js. And there's a framework called Svelte that is a SPA framework without a vDOM.

Re:Asm-dom, a minimal WebAssembly virtual DOM to build C++ SPA by makkesk8 on Monday March 16, 2020 @07:56AM (#22591922)
Yes, Svelte does not utilize a virtual DOM.