diff options
author | John Resig <jeresig@gmail.com> | 2010-09-28 11:12:13 -0400 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2010-09-28 11:12:13 -0400 |
commit | c7c067723006b0dfbb123c1a36885580a587d091 (patch) | |
tree | 28cf6c09f7f970792ffe7dfd2ca9257fc476f0e5 /test | |
parent | cf672a2e7a886cac5ae62f6772c6b4b43b19a2fc (diff) | |
download | jquery-c7c067723006b0dfbb123c1a36885580a587d091.tar.gz jquery-c7c067723006b0dfbb123c1a36885580a587d091.zip |
Make .attr(name, null) equivalent to removeAttr(name). (Was roughly this before - but is now consistent across platforms). Fixes #6341.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/attributes.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 3326dfe89..de7754b8a 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -98,15 +98,18 @@ test("attr(Hash)", function() { }); test("attr(String, Object)", function() { - expect(23); + expect(24); + var div = jQuery("div").attr("foo", "bar"), fail = false; + for ( var i = 0; i < div.size(); i++ ) { if ( div.get(i).getAttribute('foo') != "bar" ){ fail = i; break; } } + equals( fail, false, "Set Attribute, the #"+fail+" element didn't get the attribute 'foo'" ); // Fails on IE since recent changes to .attr() @@ -114,6 +117,8 @@ test("attr(String, Object)", function() { jQuery("#name").attr('name', 'something'); equals( jQuery("#name").attr('name'), 'something', 'Set name attribute' ); + jQuery("#name").attr('name', null); + equals( jQuery("#name").attr('title'), '', 'Remove name attribute' ); jQuery("#check2").attr('checked', true); equals( document.getElementById('check2').checked, true, 'Set checked attribute' ); jQuery("#check2").attr('checked', false); |