Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for #883
  • Loading branch information
jzaefferer committed Jan 31, 2007
1 parent 4e256bf commit a82b048
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/jquery/coreTest.js
Expand Up @@ -102,14 +102,16 @@ test("attr(Hash)", function() {
});

test("attr(String, Object)", function() {
expect(6);
expect(7);
var div = $("div");
div.attr("foo", "bar");
var pass = true;
for ( var i = 0; i < div.size(); i++ ) {
if ( div.get(i).getAttribute('foo') != "bar" ) pass = false;
}
ok( pass, "Set Attribute" );

ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" );

$("#name").attr('name', 'something');
ok( $("#name").attr('name') == 'something', 'Set name attribute' );
Expand Down
2 changes: 1 addition & 1 deletion src/jquery/jquery.js
Expand Up @@ -1281,7 +1281,7 @@ jQuery.extend({
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;

// Handle passing in a number to a CSS property
if ( value.constructor == Number && type == "curCSS" && !exclude.test(prop) )
if ( value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) )
return value + "px";

return value;
Expand Down

0 comments on commit a82b048

Please sign in to comment.