This commit is contained in:
Jörn Zaefferer 2007-01-31 21:36:48 +00:00
parent 4e256bffa3
commit a82b048db8
2 changed files with 4 additions and 2 deletions

View file

@ -102,7 +102,7 @@ test("attr(Hash)", function() {
}); });
test("attr(String, Object)", function() { test("attr(String, Object)", function() {
expect(6); expect(7);
var div = $("div"); var div = $("div");
div.attr("foo", "bar"); div.attr("foo", "bar");
var pass = true; var pass = true;
@ -110,6 +110,8 @@ test("attr(String, Object)", function() {
if ( div.get(i).getAttribute('foo') != "bar" ) pass = false; if ( div.get(i).getAttribute('foo') != "bar" ) pass = false;
} }
ok( pass, "Set Attribute" ); ok( pass, "Set Attribute" );
ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" );
$("#name").attr('name', 'something'); $("#name").attr('name', 'something');
ok( $("#name").attr('name') == 'something', 'Set name attribute' ); ok( $("#name").attr('name') == 'something', 'Set name attribute' );

View file

@ -1281,7 +1281,7 @@ jQuery.extend({
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
// Handle passing in a number to a CSS property // 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 + "px";
return value; return value;