diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2015-05-05 08:31:39 -0700 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2015-05-05 08:31:39 -0700 |
commit | 6176567361e9d05d4f5eb7e98735a678f2cd7ea9 (patch) | |
tree | 3db3de394138622320dd8d95318338b76dc3f1df /src/offset.js | |
parent | 1617479fcf7cbdaf33dc9334ed10a0f30bf14687 (diff) | |
download | jquery-6176567361e9d05d4f5eb7e98735a678f2cd7ea9.tar.gz jquery-6176567361e9d05d4f5eb7e98735a678f2cd7ea9.zip |
Offset: remove ownerDocument check in offset getter
Fixes gh-2115
Diffstat (limited to 'src/offset.js')
-rw-r--r-- | src/offset.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/offset.js b/src/offset.js index 49ff26ac9..adcc8d64c 100644 --- a/src/offset.js +++ b/src/offset.js @@ -74,6 +74,7 @@ jQuery.offset = { jQuery.fn.extend({ offset: function( options ) { + // Preserve chaining for setter if ( arguments.length ) { return options === undefined ? this : @@ -82,11 +83,10 @@ jQuery.fn.extend({ }); } - var docElem, win, rect, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; + var docElem, win, rect, doc, + elem = this[ 0 ]; - if ( !doc ) { + if ( !elem ) { return; } @@ -94,6 +94,7 @@ jQuery.fn.extend({ // Make sure element is not hidden (display: none) or disconnected if ( rect.width || rect.height || elem.getClientRects().length ) { + doc = elem.ownerDocument; win = getWindow( doc ); docElem = doc.documentElement; |