Need to also handle the case where 'auto' is being returned, as in Firefox. Follow-up to #7395.

This commit is contained in:
jeresig 2010-11-09 23:33:18 -05:00
parent 3394d32ea7
commit efaf375e56

View file

@ -179,7 +179,7 @@ jQuery.each(["height", "width"], function( i, name ) {
if ( val != null ) { if ( val != null ) {
// Should return "auto" instead of 0, use 0 for // Should return "auto" instead of 0, use 0 for
// temporary backwards-compat // temporary backwards-compat
return val === "" ? "0px" : val; return val === "" || val === "auto" ? "0px" : val;
} }
} }
@ -188,7 +188,7 @@ jQuery.each(["height", "width"], function( i, name ) {
// Should return "auto" instead of 0, use 0 for // Should return "auto" instead of 0, use 0 for
// temporary backwards-compat // temporary backwards-compat
return val === "" ? "0px" : val; return val === "" || val === "auto" ? "0px" : val;
} }
return typeof val === "string" ? val : val + "px"; return typeof val === "string" ? val : val + "px";