Ask HN: Why Shadow DOM Instead of Canvas?
I’m curious why client-side Single Page Application frameworks like React & Angular use HTML & CSS for rendering instead of using the Canvas or WebGL APIs. It’s always seemed like Canvas is underutilized. And it seems like React/Angular style frameworks want to do everything in Typescript anyway.
Canvas - https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
WebGL - https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API
8 comments
[ 5.2 ms ] story [ 34.4 ms ] threadYeah, I've got no idea. If your first intuition when making a web-app is that you want to figure out how to custom render UI elements with subpixel anti-aliased fonts on an OpenGL surface and interface with screenreaders all on your own, you must be a PM at a large SV company with hundreds of bored developers whose KPIs measure only "how many more good things about the open Web can we ruin this month?"
Sorry, you've touched a nerve with this one :)
So, no, I actually meant it as a real question and am curious what reasons people have. My suspicion is people aren’t aware of the Canvas API. People tend to use the technologies they know instead of taking a beat to look around and learn.
That being said, I for the Typescript part, I think it's just badly worded and what OP is getting at is that most modern FE frameworks favor JSS over CSS stylesheets.