This commit is contained in:
Brandon Aaron 2007-05-11 22:29:16 +00:00
parent f5a2db89fd
commit 009033bb45
2 changed files with 7 additions and 2 deletions

View file

@ -766,7 +766,7 @@ test("addClass(String)", function() {
});
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++ ) {
@ -782,6 +782,11 @@ test("removeClass(String) - simple", function() {
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() {

View file

@ -1349,7 +1349,7 @@ jQuery.extend({
// 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(" ") : "";