diff options
Diffstat (limited to 'src/css.js')
-rw-r--r-- | src/css.js | 50 |
1 files changed, 7 insertions, 43 deletions
diff --git a/src/css.js b/src/css.js index c92fc684a..91c42624e 100644 --- a/src/css.js +++ b/src/css.js @@ -10,7 +10,6 @@ define( [ "./css/var/swap", "./css/curCSS", "./css/adjustCSS", - "./css/addGetHookIf", "./css/support", "./css/finalPropName", @@ -18,7 +17,7 @@ define( [ "./core/ready", "./selector" // contains ], function( jQuery, access, rcssNum, rnumnonpx, cssExpand, isAutoPx, cssCamelCase, - getStyles, swap, curCSS, adjustCSS, addGetHookIf, support, finalPropName ) { + getStyles, swap, curCSS, adjustCSS, support, finalPropName ) { "use strict"; @@ -130,7 +129,6 @@ function getWidthOrHeight( elem, dimension, extra ) { val = curCSS( elem, dimension, styles ), offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - // Support: Firefox <=54 // Return a confounding non-pixel value or feign ignorance, as appropriate. if ( rnumnonpx.test( val ) ) { if ( !extra ) { @@ -142,15 +140,11 @@ function getWidthOrHeight( elem, dimension, extra ) { // Fall back to offsetWidth/offsetHeight when value is "auto" // This happens for inline elements with no explicit setting (gh-3571) - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - // Support: IE 9-11 only + // Support: IE 9 - 11+ // Also use offsetWidth/offsetHeight for when box sizing is unreliable // We use getClientRects() to check for hidden/disconnected. // In those cases, the computed value can be trusted to be border-box - if ( ( !support.boxSizingReliable() && isBorderBox || - val === "auto" || - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && + if ( ( !support.boxSizingReliable() && isBorderBox || val === "auto" ) && elem.getClientRects().length ) { isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; @@ -324,10 +318,10 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) { // but it must have a current display style that would benefit return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero + // Support: Safari <=8 - 12+, Chrome <=73+ + // Table columns in WebKit/Blink have non-zero offsetWidth & zero // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only + // Support: IE <=11+ // Running getBoundingClientRect on a disconnected node // in IE throws an error. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? @@ -342,14 +336,8 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) { var matches, styles = getStyles( elem ), - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && + isBorderBox = extra && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", subtract = extra ? boxModelAdjustment( @@ -361,17 +349,6 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) { ) : 0; - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - // Convert to pixels if value adjustment is needed if ( subtract && ( matches = rcssNum.exec( value ) ) && ( matches[ 3 ] || "px" ) !== "px" ) { @@ -385,19 +362,6 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) { }; } ); -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - // These hooks are used by animate to expand properties jQuery.each( { margin: "", |