I apologize if this question already exists, but I couldn't find it.
In the following code, at which points will a page reflow/repaint be triggered, assuming a DOM object is updated at each point?
(function() {
//POINT A
for (var a=0; a<2; a++) {
//POINT B
for (var b=0; b<2; b++) {
//POINT C
}
//POINT D
for (var b=0; b<2; b++) {
//POINT E
}
//POINT F
}
//POINT G
})();
//POINT H
Essentially, I'm not sure if the DOM has the ability to update in the middle of functions, loops, etc. Can it update every time an element is moved? Only after exiting loops? After all active loops have exited? After all functions have finished?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…