File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1052
1052
function getOffsetParent ( element ) {
1053
1053
element = $ ( element ) ;
1054
1054
1055
+ // Ensure we never return the root HTML tag.
1056
+ function selfOrBody ( element ) {
1057
+ return isHtml ( element ) ? $ ( document . body ) : $ ( element ) ;
1058
+ }
1059
+
1055
1060
// For unusual cases like these, we standardize on returning the BODY
1056
1061
// element as the offset parent.
1057
1062
if ( isDocument ( element ) || isDetached ( element ) || isBody ( element ) || isHtml ( element ) )
1058
1063
return $ ( document . body ) ;
1059
1064
1060
1065
// IE reports offset parent incorrectly for inline elements.
1061
1066
var isInline = ( Element . getStyle ( element , 'display' ) === 'inline' ) ;
1062
- if ( ! isInline && element . offsetParent ) return $ ( element . offsetParent ) ;
1067
+ if ( ! isInline && element . offsetParent ) return selfOrBody ( element . offsetParent ) ;
1063
1068
1064
1069
while ( ( element = element . parentNode ) && element !== document . body ) {
1065
1070
if ( Element . getStyle ( element , 'position' ) !== 'static' ) {
1066
- return isHtml ( element ) ? $ ( document . body ) : $ ( element ) ;
1071
+ return selfOrBody ( element ) ;
1067
1072
}
1068
1073
}
1069
1074
1559
1564
1560
1565
var currentLayout = element . getLayout ( ) ;
1561
1566
1562
- console . log ( 'this far?' ) ;
1563
1567
// Use content box when setting width/height. If padding/border are
1564
1568
// different between source and target, that's for the user to fix;
1565
1569
// there's no good option for us.
You can’t perform that action at this time.
0 commit comments