Skip to content

Commit

Permalink
Position: Guard against passing window to offset
Browse files Browse the repository at this point in the history
Starting in jQuery 3.0 this will throw an error

Fixes #13493
Closes gh-1565
  • Loading branch information
arschmitz committed Jul 8, 2015
1 parent bec722a commit b3a9b13
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit b3a9b13

Please sign in to comment.