]> source.dussan.org Git - jquery.git/commitdiff
Merge branch 'master' of https://github.com/inukshuk/jquery into inukshuk-master
authorjeresig <jeresig@gmail.com>
Tue, 12 Apr 2011 04:25:36 +0000 (00:25 -0400)
committerjeresig <jeresig@gmail.com>
Tue, 12 Apr 2011 04:25:36 +0000 (00:25 -0400)
Conflicts:
test/unit/offset.js

1  2 
src/offset.js
test/unit/offset.js

diff --cc src/offset.js
index a0cd7a15661b04890a83f0b8b7ecc08f9ba1a99c,94b67c77a99f11789263d4edf3bcd702d52576bd..7abd6af17ddc3924e16061e26c84768b71b10be1
@@@ -180,17 -181,19 +180,19 @@@ jQuery.offset = 
                        curOffset = curElem.offset(),
                        curCSSTop = jQuery.css( elem, "top" ),
                        curCSSLeft = jQuery.css( elem, "left" ),
 -                      calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
 +                      calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1,
                        props = {}, curPosition = {}, curTop, curLeft;
  
 -              // need to be able to calculate position if either top or left is auto and position is absolute
 +              // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
                if ( calculatePosition ) {
                        curPosition = curElem.position();
+                       curTop = curPosition.top;
+                       curLeft = curPosition.left;
+               } else {
+                       curTop = parseFloat( curCSSTop ) || 0;
+                       curLeft = parseFloat( curCSSLeft ) || 0;
                }
  
-               curTop  = calculatePosition ? curPosition.top  : parseInt( curCSSTop,  10 ) || 0;
-               curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
                if ( jQuery.isFunction( options ) ) {
                        options = options.call( elem, i, curOffset );
                }
Simple merge