One of the most powerful features of APE.dom
is
getOffsetCoords(el, container[, coords]);
.
APE.dom.getOffsetCoords
returns the
coordinates of the element relative to an optional ancestor, e.g. { x : 10, y : 10 }
I tested the shit out of it.
Please find a case where getOffsetCoords()
will fail.
Function APE.dom.getOffsetCoords()
is blazingly fast. Results in a complex tree with
scrolled parents takes on average 2.5ms in Firefox (the worst performer).
Finding an element's position is extremely
hard. It is hard because of differences in
offsetTop
, offsetLeft
, and offsetParent
.
Other libraries have attempted to address these differences with browser detection. This is bad for a few reasons:
Other libraries will fail when there is
margin
and position
on body
.
They're also slower. Some of the "better" libraries take up to 15ms to return wrong results. That sucks!