That's very tempting, but you lose a lot if you do that, especially around text:
* Accessibility for screen readers, etc.
* The easy ability to select text, copy/paste between other apps, etc.
* Line splitting
* Support for multiple languages, RTL, and all their other rendering quirks.
Canvas has some text APIs, but they are fairly rudimentary. It's a hard problem.
That's an understatement for sure. `measureText` is not even close to feature parity with where windows apis were 25 years ago.
Or something like text underlines has to be done entirely manually.
It requires a lot of extra work, but real world apps like Figma [0] are rendering directly to the canvas, and frameworks like Flutter offer support for canvas rendering (via Skia's CanvasKit) [1] [2].
I guess my point is that if someone is using WASM to ditch JavaScript, why stop there? Ditch the DOM and CSS too! Render all of the graphics with OpenGl or WebGPU!
There is a class of applications that I want to explore that would be better suited to by doing just that. I don't believe every app should do that, just that for what I want to build, that's where I'm looking at going (hence my "if it were up to me" comment above).
[0] https://www.figma.com/blog/building-a-professional-design-to...
[1] https://docs.flutter.dev/platform-integration/web/renderers
We tried this with flash already. It has the same issues. Browsers provide _a lot more_ than just rendering your html+css. There are cases where it makes sense, but generally, it's a terrible idea. It will be like trying to make a visual novel using youtube in-video links.