diff options
author | Matthias Jäggli <matthias.jaeggli@scout24.ch> | 2012-08-28 16:26:06 +0300 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-10-21 21:06:41 -0400 |
commit | 227c49a4596423a125bdcb1d25a2263e526360db (patch) | |
tree | 769820170acef0b190b34e9e4979f9ae610d256c /test/unit/attributes.js | |
parent | 23d125a51acc1cd2d127c9feb684aa96cea7d1fc (diff) | |
download | jquery-227c49a4596423a125bdcb1d25a2263e526360db.tar.gz jquery-227c49a4596423a125bdcb1d25a2263e526360db.zip |
Fix #12411, .removeClass(undefined) is a chaining no-op. Close gh-913.
.removeClass() //removes all classes, as documented
.removeClass(window.nonExistentVariable) // removes nothing
Diffstat (limited to 'test/unit/attributes.js')
-rw-r--r-- | test/unit/attributes.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 9ead9a9b9..0e51ee137 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1202,6 +1202,15 @@ test( "removeClass() removes duplicates", function() { ok( !$div.hasClass("x"), "Element with multiple same classes does not escape the wrath of removeClass()" ); }); +test("removeClass(undefined) is a no-op", function() { + expect( 1 ); + + var $div = jQuery("<div class='base second'></div>"); + $div.removeClass( undefined ); + + ok( $div.hasClass("base") && $div.hasClass("second"), "Element still has classes after removeClass(undefined)" ); +}); + var testToggleClass = function(valueObj) { expect( 17 ); |