Fix for #883
This commit is contained in:
parent
4e256bffa3
commit
a82b048db8
2 changed files with 4 additions and 2 deletions
4
src/jquery/coreTest.js
vendored
4
src/jquery/coreTest.js
vendored
|
@ -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' );
|
||||||
|
|
2
src/jquery/jquery.js
vendored
2
src/jquery/jquery.js
vendored
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue