When we modify DOM it becomes "dirty", and after our script finishes, reflow/re-render happens. But also, if our script queries DOM properties, like elem.clientHeight, DOM may need to perform the calculations in order to return us correct values, reflecting all the recent property changes. For example, if we access element.clientHeight browser may need to calculate re-flow (I recently encountered very slow clientHeight calculation by FireFox).
So, if we only modify DOM properties, all the re-rendering is deferred till the end of script.
When we modify DOM it becomes "dirty", and after our script finishes, reflow/re-render happens. But also, if our script queries DOM properties, like elem.clientHeight, DOM may need to perform the calculations in order to return us correct values, reflecting all the recent property changes. For example, if we access element.clientHeight browser may need to calculate re-flow (I recently encountered very slow clientHeight calculation by FireFox).
So, if we only modify DOM properties, all the re-rendering is deferred till the end of script.
Google about "DOM reflow"