diff --git a/src/css.js b/src/css.js index aea0ef2c5..cc873994b 100644 --- a/src/css.js +++ b/src/css.js @@ -358,10 +358,14 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) { set: function( elem, value, extra ) { var matches, styles = getStyles( elem ), - scrollBoxSize = support.scrollboxSize() === styles.position, + + // 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 = scrollBoxSize || extra, + boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", subtract = extra ? @@ -376,7 +380,7 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) { // 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 && scrollBoxSize ) { + if ( isBorderBox && scrollboxSizeBuggy ) { subtract -= Math.ceil( elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - parseFloat( styles[ dimension ] ) - diff --git a/src/css/support.js b/src/css/support.js index 12706f7e9..9c4da57d9 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -46,7 +46,7 @@ define( [ // Support: Chrome <=64 // Don't get tricked when zoom affects offsetWidth (gh-4029) div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12 || "absolute"; + scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; documentElement.removeChild( container ); diff --git a/test/unit/support.js b/test/unit/support.js index 0983d2295..6019819c5 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -107,7 +107,7 @@ testIframe( "pixelPosition": true, "radioValue": false, "reliableMarginLeft": true, - "scrollboxSize": "absolute" + "scrollboxSize": false }, chrome: { "ajax": true,