aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-06-17 11:33:06 -0400
committerAlexander Schmitz <arschmitz@gmail.com>2015-07-08 00:15:34 -0400
commitb3a9b13a218cd90b7cf67be5d5f8ad6e76c557b0 (patch)
tree61575795d63c07fce7cfce802cf384017ff66fbe /ui
parentbec722abdb27f86a4938446af4720cb3aea861c8 (diff)
downloadjquery-ui-b3a9b13a218cd90b7cf67be5d5f8ad6e76c557b0.tar.gz
jquery-ui-b3a9b13a218cd90b7cf67be5d5f8ad6e76c557b0.zip
Position: Guard against passing window to offset
Starting in jQuery 3.0 this will throw an error Fixes #13493 Closes gh-1565
Diffstat (limited to 'ui')
-rw-r--r--ui/position.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/position.js b/ui/position.js
index 367fc3978..172503fef 100644
--- a/ui/position.js
+++ b/ui/position.js
@@ -142,12 +142,13 @@ $.position = {
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
isWindow = $.isWindow( withinElement[ 0 ] ),
- isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
+ isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
+ hasOffset = !isWindow && !isDocument;
return {
element: withinElement,
isWindow: isWindow,
isDocument: isDocument,
- offset: withinElement.offset() || { left: 0, top: 0 },
+ offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
width: withinElement.outerWidth(),