3 ms·
Can someone explain why the "Quick Fix" even works? It seems like if having the DOM updates separated by one statement triggers two reflows, so would two consec
by icambron 13y ago
Can someone explain why the "Quick Fix" even works? It seems like if having the DOM updates separated by one statement triggers two reflows, so would two consecutive updates. Or more generally, what does "batching DOM updates" really mean?
Does the browser just pay attention to whether each line of JS updates the DOM and queue up its updates until it encounters one that doesn't? Doesn't fit my model for how the JS engine fits into the browser. I guess I don't really know, but I always assumed it just reflowed on a fixed timeout.
Edit: Nevermind, I get it: it's that the intervening statement reads from the DOM, thus triggering a flush. I just missed that in the article.
- deleted 13y ago[deleted]