#PerfTip: If you ask for an element's box size (eg:offsetHeight) in any way, it will cause a re-layout to answer your question.
2
3
10
And as you can imagine, if this is a deeply nested child with a lot of auto/dependent calculations, this can become expensive. Use it wisely
1
Is there a list of all properties that require re-layout?
3
I was actually thinking of writing a blog post about this, but my tweet sums it up, if you need a box calc - you'll force reflow
1
So getBoundingClientRect() also forces reflow? Makes sense once you think about it.
2
1
Replying to @ppk @gregwhitworth
It forces reflow if the layout is dirty, as a result of a prior change (e.g., to DOM, to CSS property requiring layout)

Jan 19, 2017 路 5:05 PM UTC

4