I've read on SO and elsewhere that re-paints and re-flows are expensive for the browser to perform.
I'm curious about CSS/JS alternatives to re-paint/display:none
and re-flow/visibility:hidden
that aren't as computationally demanding for the browser.
Just to be clear, and please correct me if I'm wrong, a common re-flow scenario is when you set display:none
on element that you want to toggle the display of, e.g., a dropdown menu. The re-flow means that the browser first "flows", i.e., displays, the element and everything beneath as visible content but then has to re-flow all of it because the dropdown menu needs to be hidden.
Commentary on whether the performance hit of re-flow and re-paint is actually something that people need to care about is welcome too.