On 9/18/06, Klaus Hartl <[EMAIL PROTECTED]> wrote: > > > limodou schrieb: > > This code I copy from prototype, and made some changes, it doesnot > > calculate the width and height, only x and y, but it's quicker than > > jUtil.getPos(). BTW, I think interface plugins is wonderful, I begin > > use it to replace some functions written by me. > > > > $.fn.coordinate = function(){ > > e = this[0]; > > var y = 0, x = 0; > > do { > > y += e.offsetTop || 0; > > x += e.offsetLeft || 0; > > e = e.offsetParent; > > if (e) { > > if(e.tagName=='BODY') break; > > var p = $(e).position(); > > if (p == 'relative' || p == 'absolute') break; > > } > > } while (e); > > return {x:x, y:y}; > > } > > > > It seems that iUtil.getPos() does not test BODY node, and does not > > test position, so maybe these slow it down. > > > > to make it xhtml as xml compatible you should normalize tagName: > > if (e.tagName.toLowerCase() == 'body') break; > > Thanks.
-- I like python! My Blog: http://www.donews.net/limodou UliPad Site: http://wiki.woodpecker.org.cn/moin/UliPad UliPad Maillist: http://groups.google.com/group/ulipad _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/