Safari getBoundingClientRect () Injection Return Invalid Up

I have a div

s float: right

and I am trying to get its distance from the top of the viewport. In every browser except Safari, I get the expected results from element.getBoundingClientRect().top

. Safari seems to be reporting the distance of the element from the top of the page, not the viewport. This is contrary to what is defined in the specification for this method (as I understand it). Is Safari just breaking the rules here, or are other browsers more forgiving of some kind of bug I can't see?

+3


source to share


1 answer


This seems to be a bug that affects how Safari reports items and scroll locations in its load event. If you run the same call with a 500ms timeout, everything works as expected.



I will update when I find out my bug report.

+3


source







All Articles