forced synchronous layout
When JavaScript reads a geometry value such as offsetHeight after changing styles, making the browser run layout immediately to give an up-to-date answer.
In more detail
Normally the browser delays layout and does it once before the next frame. Reading geometry after a write forces it to happen right away, and doing that repeatedly in a loop becomes layout thrashing.
Related terms
- layout thrashing — Slowing a page by repeatedly changing styles and then reading sizes, forcing the browser to recalculate layout again and again.
- layout — The rendering stage in which the browser calculates the exact position and size of every box on the page.
- offsetHeight — An element property giving its rendered height in pixels, one of several geometry reads that make the browser finish any pending layout first.
Taught in
- Layout, Reflow, Paint And GPU Compositing Layers — Frontend Architecture & Web Platform