Each time an element of the DOM changes, the browser will have to recalculate elements and styles and also it might have to re-flow the page. The following is the typical workflow:
Recalculate Style → Layout → Paint
Recalculate Style: changing the DOM causes the browser t...