diff --git a/src/css.js b/src/css.js index 87bf2481d..2395f42b4 100644 --- a/src/css.js +++ b/src/css.js @@ -163,10 +163,17 @@ function getWidthOrHeight( elem, dimension, extra ) { valueIsBorderBox = valueIsBorderBox && ( support.boxSizingReliable() || val === elem.style[ dimension ] ); - // Fall back to offsetWidth/Height when value is "auto" + // Fall back to offsetWidth/offsetHeight when value is "auto" // This happens for inline elements with no explicit setting (gh-3571) - if ( val === "auto" ) { + // Support: Android <=4.1 - 4.3 only + // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) + if ( val === "auto" || + !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) { + val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ]; + + // offsetWidth/offsetHeight provide border-box values + valueIsBorderBox = true; } // Normalize "" and auto diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 13cd9662b..991a59113 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -544,6 +544,25 @@ QUnit.test( "width/height on an inline element with no explicitly-set dimensions } ); } ); +QUnit.test( "width/height on a table row with phantom borders (gh-3698)", function( assert ) { + assert.expect( 4 ); + + jQuery( "
" + + " |