Add position()
EDIT
Is there any specific reason to why the function
offset()is called like that, and notposition(), like in jQuery?Since
offsetLeft, etc.. all measure the offset to their next offsetParent, it seams kind of strange to have offset() return the position in the browser window...
Ok.. I'm sorry, I confused the jQuery functions. It's just that position() is missing from bonzos toolkit.
the goal of most of my core Ender modules was to reduce the cruft that you didn't need in jQuery. getting an offsetTop from an offsetParent is simple, so I didn't include it. but in either case, are you running into a real issue with it being named offset()? I preferred the name over position
Well.. I think that jQuery's naming convention is a bit strange here... if offsetLeft in an element is the position from an offsetParent then I would assume that offset() returns the offsets, not position().
Also: offsetLeft doesn't work as expected in IE6 + IE7, so jQuery handles that for you (but I really don't need that support.. just saying that it makes sense to wrap it).
Getting the right offsets (inside offsetParent) in inline elements is also not that obvious...
Also: Webkit has a very weird offset bug if an offsetParent is inline: http://jsfiddle.net/enyo/uDeZ9/ (Test it in Webkit and FF / Opera)