diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jquery/coreTest.js | 4 | ||||
-rw-r--r-- | src/jquery/jquery.js | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index a7b470e09..0bb972756 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -102,7 +102,7 @@ test("attr(Hash)", function() { });
test("attr(String, Object)", function() {
- expect(6);
+ expect(7);
var div = $("div");
div.attr("foo", "bar");
var pass = true;
@@ -110,6 +110,8 @@ test("attr(String, Object)", function() { 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' );
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 933e97433..76f11d76a 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -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; |