mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04: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
This commit is contained in:
parent
bec722abdb
commit
b3a9b13a21
@ -142,12 +142,13 @@ $.position = {
|
|||||||
getWithinInfo: function( element ) {
|
getWithinInfo: function( element ) {
|
||||||
var withinElement = $( element || window ),
|
var withinElement = $( element || window ),
|
||||||
isWindow = $.isWindow( withinElement[ 0 ] ),
|
isWindow = $.isWindow( withinElement[ 0 ] ),
|
||||||
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
|
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
|
||||||
|
hasOffset = !isWindow && !isDocument;
|
||||||
return {
|
return {
|
||||||
element: withinElement,
|
element: withinElement,
|
||||||
isWindow: isWindow,
|
isWindow: isWindow,
|
||||||
isDocument: isDocument,
|
isDocument: isDocument,
|
||||||
offset: withinElement.offset() || { left: 0, top: 0 },
|
offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
|
||||||
scrollLeft: withinElement.scrollLeft(),
|
scrollLeft: withinElement.scrollLeft(),
|
||||||
scrollTop: withinElement.scrollTop(),
|
scrollTop: withinElement.scrollTop(),
|
||||||
width: withinElement.outerWidth(),
|
width: withinElement.outerWidth(),
|
||||||
|
Loading…
Reference in New Issue
Block a user