diff options
Diffstat (limited to 'ui/position.js')
-rw-r--r-- | ui/position.js | 5 |
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(), |