diff --git a/src/css.js b/src/css.js index 2395f42b4e..107d85a932 100644 --- a/src/css.js +++ b/src/css.js @@ -153,9 +153,13 @@ function getWidthOrHeight( elem, dimension, extra ) { isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", valueIsBorderBox = isBorderBox; - // Computed unit is not pixels. Stop here and return. + // Support: Firefox <=54 + // Return a confounding non-pixel value or feign ignorance, as appropriate. if ( rnumnonpx.test( val ) ) { - return val; + if ( !extra ) { + return val; + } + val = "auto"; } // Check for style in case a browser which returns unreliable values diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 991a59113d..d7e5533690 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -544,6 +544,29 @@ QUnit.test( "width/height on an inline element with no explicitly-set dimensions } ); } ); +QUnit.test( "width/height on an inline element with percentage dimensions (gh-3611)", + function( assert ) { + assert.expect( 4 ); + + jQuery( "