diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2007-01-31 21:36:48 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2007-01-31 21:36:48 +0000 |
commit | a82b048db8c72dccb019e086e0ca50617df14915 (patch) | |
tree | fddb4ed0499deae5869af26ce0c21a6bb1b95e2e /src | |
parent | 4e256bffa320f1fe87f6e4daf17bbb4ed29ae88a (diff) | |
download | jquery-a82b048db8c72dccb019e086e0ca50617df14915.tar.gz jquery-a82b048db8c72dccb019e086e0ca50617df14915.zip |
Fix for #883
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; |