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(),