});
test("removeClass(String) - simple", function() {
- expect(2);
+ expect(3);
var div = $("div").addClass("test").removeClass("test"),
pass = true;
for ( var i = 0; i < div.size(); i++ ) {
if ( div.get(i).className.match(/test|bar|foo/) ) pass = false;
}
ok( pass, "Remove multiple classes" );
+
+ reset();
+ var div = $("div:eq(0)").addClass("test").removeClass("");
+ ok( div.is('.test'), "Empty string passed to removeClass" );
+
});
test("toggleClass(String)", function() {
// internal only, use removeClass("class")
remove: function( elem, c ){
- elem.className = c ?
+ elem.className = c != undefined ?
jQuery.grep( elem.className.split(/\s+/), function(cur){
return !jQuery.className.has( c, cur );
}).join(" ") : "";