The BoxObject for an element works fine in the simple scenario where only
the root element has a scrollable overflow. Whenever one or more ancestor
elements has been scrolled the returned box is incorrect and returns the
value that would have been correct when all the scrollable elements had
scrollTop 0.

#e1, #e2 {
   overflow: auto;
}

<element id="e1">
   ...
   <element id="e2">
      ...
      <element id="e3">...</element>
      ...
   </element>
   ...
</element>

var y = document.getBoxObjectFor(document,getElementById("e3")).y

y is only correct if the elements e1 and e2 have not been scrolled.

Is this a known bug? Maybe this is even intentional? Any information
appreciated since the BoxObject seems like the holy grail for finding the
position of an element relative to the document, client viewport and screen.

erik



Reply via email to