diff --git a/src/css.js b/src/css.js index 4496594dc..94f8d8903 100644 --- a/src/css.js +++ b/src/css.js @@ -480,7 +480,7 @@ jQuery.each([ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { - if ( elem.offsetWidth !== 0 ) { + if ( elem.offsetWidth !== 0 || curCSS( elem, "display" ) !== "none" ) { return getWidthOrHeight( elem, name, extra ); } else { return jQuery.swap( elem, cssShow, function() { diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 53e37b95d..6fc346dce 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -299,6 +299,16 @@ test("outerWidth(true) returning % instead of px in Webkit, see #10639", functio equal( el.outerWidth(true), 400, "outerWidth(true) and css('margin') returning % instead of px in Webkit, see #10639" ); }); +test( "getting dimensions of zero width/height table elements shouldn't alter dimensions", function() { + expect( 1 ); + + var table = jQuery("
| a | |
| a |