mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
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 b3a9b13a21
)
This commit is contained in:
parent
330db543f8
commit
4394503276
@ -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(),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user