Limit the scope of the CSS 'auto' change to just height/width. Fixes #7293.

This commit is contained in:
jeresig 2010-11-03 18:57:22 -04:00
parent 335e0a33e1
commit 3e38a861fe
2 changed files with 7 additions and 3 deletions

View file

@ -177,7 +177,7 @@ jQuery.each(["height", "width"], function( i, name ) {
} }
if ( val != null ) { if ( val != null ) {
return val; return val === "" ? "auto" : val;
} }
} }
@ -252,7 +252,7 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
} }
} }
return ret === "" ? "auto" : ret; return ret;
}; };
} }

View file

@ -6,7 +6,7 @@ test("sanity check", function() {
}); });
test("show()", function() { test("show()", function() {
expect(27); expect(28);
var hiddendiv = jQuery("div.hidden"); var hiddendiv = jQuery("div.hidden");
@ -14,6 +14,10 @@ test("show()", function() {
equals( hiddendiv.css("display"), "block", "Make sure a pre-hidden div is visible." ); equals( hiddendiv.css("display"), "block", "Make sure a pre-hidden div is visible." );
var div = jQuery("<div>").hide().appendTo("body").show();
equal( div.css("display"), "block", "Make sure pre-hidden divs show" );
QUnit.reset(); QUnit.reset();
hiddendiv = jQuery("div.hidden"); hiddendiv = jQuery("div.hidden");