diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2015-06-15 11:02:08 -0400 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2015-06-16 10:55:11 -0400 |
commit | 40dcc767640c41a4387a343f1ef53ac57ed631c5 (patch) | |
tree | bfe833213b0c0fb3f3306a80c20f5c4baa333bcd /src | |
parent | 578dcee96a8d4d759b3a7e623177fa36a5133ba7 (diff) | |
download | jquery-40dcc767640c41a4387a343f1ef53ac57ed631c5.tar.gz jquery-40dcc767640c41a4387a343f1ef53ac57ed631c5.zip |
Offset: return zeros for disconnected/hidden elements
Fixes gh-2310
Close gh-2396
Diffstat (limited to 'src')
-rw-r--r-- | src/offset.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/offset.js b/src/offset.js index a6aa2f1d5..fcb7b14de 100644 --- a/src/offset.js +++ b/src/offset.js @@ -32,7 +32,7 @@ jQuery.offset = { elem.style.position = "relative"; } - curOffset = curElem.offset() || { top: 0, left: 0 }; + curOffset = curElem.offset(); curCSSTop = jQuery.css( elem, "top" ); curCSSLeft = jQuery.css( elem, "left" ); calculatePosition = ( position === "absolute" || position === "fixed" ) && @@ -103,6 +103,9 @@ jQuery.fn.extend({ left: rect.left + win.pageXOffset - docElem.clientLeft }; } + + // Return zeros for disconnected and hidden elements (gh-2310) + return rect; }, position: function() { |