@@ -439,7 +439,7 @@ $.widget("ui.draggable", $.ui.mouse, {
439439
440440 _setContainment : function ( ) {
441441
442- var over , c , ce ,
442+ var isUserScrollable , c , ce ,
443443 o = this . options ,
444444 document = this . document [ 0 ] ;
445445
@@ -486,13 +486,23 @@ $.widget("ui.draggable", $.ui.mouse, {
486486 return ;
487487 }
488488
489- over = c . css ( "overflow" ) !== "hidden" ;
489+ isUserScrollable = / ( s c r o l l | a u t o ) / . test ( c . css ( "overflow" ) ) ;
490490
491491 this . containment = [
492492 ( parseInt ( c . css ( "borderLeftWidth" ) , 10 ) || 0 ) + ( parseInt ( c . css ( "paddingLeft" ) , 10 ) || 0 ) ,
493493 ( parseInt ( c . css ( "borderTopWidth" ) , 10 ) || 0 ) + ( parseInt ( c . css ( "paddingTop" ) , 10 ) || 0 ) ,
494- ( over ? Math . max ( ce . scrollWidth , ce . offsetWidth ) : ce . offsetWidth ) - ( parseInt ( c . css ( "borderRightWidth" ) , 10 ) || 0 ) - ( parseInt ( c . css ( "paddingRight" ) , 10 ) || 0 ) - this . helperProportions . width - this . margins . left - this . margins . right ,
495- ( over ? Math . max ( ce . scrollHeight , ce . offsetHeight ) : ce . offsetHeight ) - ( parseInt ( c . css ( "borderBottomWidth" ) , 10 ) || 0 ) - ( parseInt ( c . css ( "paddingBottom" ) , 10 ) || 0 ) - this . helperProportions . height - this . margins . top - this . margins . bottom
494+ ( isUserScrollable ? Math . max ( ce . scrollWidth , ce . offsetWidth ) : ce . offsetWidth ) -
495+ ( parseInt ( c . css ( "borderRightWidth" ) , 10 ) || 0 ) -
496+ ( parseInt ( c . css ( "paddingRight" ) , 10 ) || 0 ) -
497+ this . helperProportions . width -
498+ this . margins . left -
499+ this . margins . right ,
500+ ( isUserScrollable ? Math . max ( ce . scrollHeight , ce . offsetHeight ) : ce . offsetHeight ) -
501+ ( parseInt ( c . css ( "borderBottomWidth" ) , 10 ) || 0 ) -
502+ ( parseInt ( c . css ( "paddingBottom" ) , 10 ) || 0 ) -
503+ this . helperProportions . height -
504+ this . margins . top -
505+ this . margins . bottom
496506 ] ;
497507 this . relativeContainer = c ;
498508 } ,
0 commit comments