5 ms·
I read the title and said "shut the fuck up, don't do that." but then I read the rationale and it's fair. It's true there is no layout engine inside canvas, and
by SeanAnderson 1y ago
I read the title and said "shut the fuck up, don't do that." but then I read the rationale and it's fair. It's true there is no layout engine inside canvas, and that is a pain, but I'm not sure it's such a pain as to invite this recursive hell.
- teaearlgraycold 1y agoYou could disallow recursion.
- deleted 1y ago[deleted]
- nine_k 1y agoOne of the more senior engineers I worked with told me: "Every real-life data structure I encountered was tree-like". It would be easiest to just ask the browser to render a fragment of HTML onto a canvas, or onto some invisible bitmap, like you can with most other UI toolkits.
- monster_truck 1y agoThey would never do this because of fingerprinting, which is already the cause of most of the reasons we cannot 'just' do a lot of things, unfortunately. E: And the infamous other half: malware. A bit over a decade ago malware devs started using canvas to do things like hide fragments inside of bitmap data in seemingly harmless ads and then a second script would extract and assemble it to evade detection.
- rezonant 1y agoThe web platform can already do this, see SVG foreignObject elsewhere in the thread. The key is to have the proper bounds in place (cross origin resources, etc), and the infrastructure for that is already in place. This just removes the extra step of relying on SVG to accomplish rendering the HTML, adds a path for getting this content into the accessibility tree, and supporting input on the rendered elements.
- mook 1y agoYeah, that's already available in Firefox for chrome/extensions, but not allowed for the web due to fingerprinting and other security risks. For example, rendering an iframe of your bank account… https://searchfox.org/mozilla-central/rev/f691af5143ebd97034e3cca0df3e320873149ade/dom/webidl/CanvasRenderingContext2D.webidl#139 https://searchfox.org/mozilla-central/rev/f691af5143ebd97034...
- deleted 1y ago[deleted]
- bongodongobob 1y ago> Every real-life data structure I encountered was tree-like I don't understand what the takeaway is here. Is that surprising? Is it not? What does "real-life" mean?
- nine_k 1y agoAs found in production code, not (only) in textbooks and academic papers. This is an exaggeration, of course.
- do_not_redeem 1y ago> Every real-life data structure I encountered was tree-like What does this even mean? Is a hash map "tree-like" somehow? Or is a hash map just a toy data structure with no real-life use cases?