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.
display:none
that one would want to use before it starts to look jerky? – Vestiarydisplay:none
then that doesn't need to be flowed and then re-flowed when the page is being rendered? Can you provide an answer which provides a typical example of what a re-flow is? – Vestiary