Skip to content

Commit

Permalink
Made sure that css('width') and height returned string values, not nu…
Browse files Browse the repository at this point in the history
…merical values. Fixes #5627.
  • Loading branch information
jeresig committed Dec 10, 2009
1 parent 6bec619 commit 4e9fed3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/css.js
Expand Up @@ -18,8 +18,8 @@ var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,

jQuery.fn.css = function( name, value ) {
return access( this, name, value, true, function( elem, name, value ) {
if (value === undefined) {
return jQuery.css( elem, name );
if ( value === undefined ) {
return jQuery.curCSS( elem, name );
}

if ( typeof value === "number" && !rexclude.test(name) ) {
Expand Down
4 changes: 3 additions & 1 deletion test/unit/css.js
@@ -1,7 +1,7 @@
module("css");

test("css(String|Hash)", function() {
expect(27);
expect(28);

equals( jQuery('#main').css("display"), 'none', 'Check for css property "display"');

Expand Down Expand Up @@ -56,6 +56,8 @@ test("css(String|Hash)", function() {
}

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() {
Expand Down

0 comments on commit 4e9fed3

Please sign in to comment.