It may be more efficient to
- first clone the entire DOM Node
- make the changes to the clone
- then replace the original with it
so you avoid multiple redraws and lower the CPU and memory load It also prevents ‘jittery’ changes to your page and Flashes Of Unstyled Content (FOUC).