Fix for #1167
This commit is contained in:
parent
f5a2db89fd
commit
009033bb45
7
src/jquery/coreTest.js
vendored
7
src/jquery/coreTest.js
vendored
|
@ -766,7 +766,7 @@ test("addClass(String)", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("removeClass(String) - simple", function() {
|
test("removeClass(String) - simple", function() {
|
||||||
expect(2);
|
expect(3);
|
||||||
var div = $("div").addClass("test").removeClass("test"),
|
var div = $("div").addClass("test").removeClass("test"),
|
||||||
pass = true;
|
pass = true;
|
||||||
for ( var i = 0; i < div.size(); i++ ) {
|
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;
|
if ( div.get(i).className.match(/test|bar|foo/) ) pass = false;
|
||||||
}
|
}
|
||||||
ok( pass, "Remove multiple classes" );
|
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() {
|
test("toggleClass(String)", function() {
|
||||||
|
|
2
src/jquery/jquery.js
vendored
2
src/jquery/jquery.js
vendored
|
@ -1349,7 +1349,7 @@ jQuery.extend({
|
||||||
|
|
||||||
// internal only, use removeClass("class")
|
// internal only, use removeClass("class")
|
||||||
remove: function( elem, c ){
|
remove: function( elem, c ){
|
||||||
elem.className = c ?
|
elem.className = c != undefined ?
|
||||||
jQuery.grep( elem.className.split(/\s+/), function(cur){
|
jQuery.grep( elem.className.split(/\s+/), function(cur){
|
||||||
return !jQuery.className.has( c, cur );
|
return !jQuery.className.has( c, cur );
|
||||||
}).join(" ") : "";
|
}).join(" ") : "";
|
||||||
|
|
Loading…
Reference in a new issue