Reputation: 1090
At various points in my 1-page web app I want to do some fairly heavy DOM manipulation, moving various divs around (which each have lots of sub-elements). I don't want the browser trying to repeatedly redraw the page mid-manipulation. Is there a way to say to the browser "pause redrawing until I give the go ahead"?
requestAnimationFrame() seems like one candidate, but is that suitable for DOM rearranging, or just for animation? Are there any other things I could do?
Thanks
Upvotes: 2
Views: 903
Reputation: 523
You can try using documentFragment.
Then the manipulation does not take place on-the-fly, you use the documentFragment as a sort of buffer.
Upvotes: 1