From 439450327626d8472edadb857cf0c71aca36b8a5 Mon Sep 17 00:00:00 2001 From: Alexander Schmitz Date: Wed, 17 Jun 2015 11:33:06 -0400 Subject: [PATCH] Position: Guard against passing window to offset Starting in jQuery 3.0 this will throw an error Fixes #13493 Closes gh-1565 (cherry picked from commit b3a9b13a218cd90b7cf67be5d5f8ad6e76c557b0) --- ui/position.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/position.js b/ui/position.js index 28aca6dc6..a59f0009d 100644 --- a/ui/position.js +++ b/ui/position.js @@ -114,13 +114,14 @@ $.position = { }, getWithinInfo: function( element ) { var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[0] ), - isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; + isWindow = $.isWindow( withinElement[ 0 ] ), + 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(), -- 2.39.5