Use getBoundingClientRect rather than offsetTop
scottjehl opened this issue · comments
Selectors matching absolutely positioned elements that are well below the fold can sometimes be included in critical css because offsetTop returns the distance to their relative parent, rather than the top of the viewport or page. getBoundingClientRect would avoid this problem.