@@ -711,31 +711,36 @@ $.widget( "ui.resizable", $.ui.mouse, {
711
711
}
712
712
713
713
// Check if CSS inline styles are set and use those (usually from previous resizes)
714
- var elWidth = ce . style . width === "" ? "" : parseFloat ( ce . style . width ) ;
715
- var elHeight = ce . style . height === "" ? "" : parseFloat ( ce . style . height ) ;
714
+ var elWidth = parseFloat ( ce . style . width ) ;
715
+ var elHeight = parseFloat ( ce . style . height ) ;
716
716
717
- if ( elWidth === "" ) {
718
- elWidth = this . _getElementSizeWithoutOverflow ( element , "width" ) ;
719
- }
720
- if ( elHeight === "" ) {
721
- elHeight = this . _getElementSizeWithoutOverflow ( element , "height" ) ;
722
- }
717
+ var paddingBorder = this . _getPaddingPlusBorderDimensions ( element ) ;
718
+ elWidth = isNaN ( elWidth ) ?
719
+ this . _getElementTheoreticalSize ( element , paddingBorder , "width" ) :
720
+ elWidth ;
721
+ elHeight = isNaN ( elHeight ) ?
722
+ this . _getElementTheoreticalSize ( element , paddingBorder , "height" ) :
723
+ elHeight ;
723
724
724
725
return {
725
726
height : elHeight ,
726
727
width : elWidth
727
728
} ;
728
729
} ,
729
730
730
- _getElementSizeWithoutOverflow : function ( element , sizeProperty ) {
731
- var overflowProperty = sizeProperty === "width" ? "overflow-y" : "overflow-x" ;
731
+ _getElementTheoreticalSize : function ( element , extraSize , dimension ) {
732
+
733
+ // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
734
+ var size = Math . max ( 0 , Math . ceil (
735
+ element . get ( 0 ) [ "offset" + dimension [ 0 ] . toUpperCase ( ) + dimension . slice ( 1 ) ] -
736
+ extraSize [ dimension ] -
737
+ 0.5
732
738
733
- var origOverflow = element . css ( overflowProperty ) ;
734
- element . css ( overflowProperty , "hidden" ) ;
735
- var elSize = parseFloat ( element . css ( sizeProperty ) ) ;
736
- element . css ( overflowProperty , origOverflow ) ;
739
+ // If offsetWidth/offsetHeight is unknown, then we can't determine theoretical size.
740
+ // Use an explicit zero to avoid NaN (gh-3964)
741
+ ) ) || 0 ;
737
742
738
- return elSize ;
743
+ return size ;
739
744
} ,
740
745
741
746
_proportionallyResize : function ( ) {
0 commit comments