4 ms·
Should browsers allow manual .paint() calls?
With the advent of react.js showing that browsers are slow if you call paint too many times, do you think at some point browsers should allow you to stop the automatic updating of the DOM, and allow you to manually trigger paint only when you choose to?
- striking 12y agoThis seems more like a StackOverflow question, but I'll bite; my opinion leans toward "no." The HTML of a page should immediately reflect its presentation, as the HTML and the presentation are inextricably linked. Furthermore, the browser repaints and realigns at times that JavaScript doesn't cause such as CSS (animations or :hover states or what have you) and manually painting only when updates happen would effectively break all of those things. Also, you'd have to keep two copies of the DOM: one that is "now" and another that is "soon-to-be." Memory usage of browsers is already horrendous, no need to exacerbate it.