On 12/8/06, Sam Collett <[EMAIL PROTECTED]> wrote:
> Perhaps it just needs a bit of minor refactoring?
>
> Still keep offset, but simplify it to use other plugins (that you
> could use separately if you only wanted the left position of an
> element for instance):
>
> jQuery.fn.offset = function(refElem) {
>     var elem = this[0];
>     return {
>         left: this.realLeft() - jQuery(refElem).realLeft(),
>         top: this.realTop() - jQuery(refElem).realTop(),
> ....etc
>     }
> }

With an approach like this it would be even slower since it would have
to query the DOM all over again just to get the left and then the top.
Perhaps separating out the scroll offsets into its own method would be
worth while. Getting the scroll offsets is very expensive since it
can't just rely on offsetParent.

--
Brandon Aaron

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to