Commit 4e9fed3b authored by John Resig's avatar John Resig

Made sure that css('width') and height returned string values, not numerical values. Fixes #5627.

parent 6bec6199
...@@ -18,8 +18,8 @@ var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, ...@@ -18,8 +18,8 @@ var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
jQuery.fn.css = function( name, value ) { jQuery.fn.css = function( name, value ) {
return access( this, name, value, true, function( elem, name, value ) { return access( this, name, value, true, function( elem, name, value ) {
if (value === undefined) { if ( value === undefined ) {
return jQuery.css( elem, name ); return jQuery.curCSS( elem, name );
} }
if ( typeof value === "number" && !rexclude.test(name) ) { if ( typeof value === "number" && !rexclude.test(name) ) {
......
module("css"); module("css");
test("css(String|Hash)", function() { test("css(String|Hash)", function() {
expect(27); expect(28);
equals( jQuery('#main').css("display"), 'none', 'Check for css property "display"'); equals( jQuery('#main').css("display"), 'none', 'Check for css property "display"');
...@@ -56,6 +56,8 @@ test("css(String|Hash)", function() { ...@@ -56,6 +56,8 @@ test("css(String|Hash)", function() {
} }
equals( prctval, checkval, "Verify fontSize % set." ); equals( prctval, checkval, "Verify fontSize % set." );
equals( typeof child.css("width"), "string", "Make sure that a string width is returned from css('width')." );
}); });
test("css(String, Object)", function() { test("css(String, Object)", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment