for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[c] + " ", " ");
}
- elem.className = className.substring(1, className.length - 1);
+ elem.className = jQuery.trim( className );
} else {
elem.className = "";
});
var testRemoveClass = function(valueObj) {
- expect(5);
+ expect(7);
var $divs = jQuery('div');
var j = jQuery("#nonnodes").contents();
j.removeClass( valueObj("asdf") );
ok( !j.hasClass("asdf"), "Check node,textnode,comment for removeClass" );
+
+ var div = document.createElement("div");
+ div.className = " test foo ";
+
+ jQuery(div).removeClass( valueObj("foo") );
+ equals( div.className, "test", "Make sure remaining className is trimmed." );
+
+ div.className = " test ";
+
+ jQuery(div).removeClass( valueObj("test") );
+ equals( div.className, "", "Make sure there is nothing left after everything is removed." );
};
test("removeClass(String) - simple", function() {