ok( pass, "Remove multiple classes" );\r
});\r
\r
+test("toggleClass(String)", function() {\r
+ var e = $("#firstp");\r
+ ok( !e.is(".test"), "Assert class not present" );\r
+ e.toggleClass("test");\r
+ ok( e.is(".test"), "Assert class present" ); \r
+ e.toggleClass("test");\r
+ ok( !e.is(".test"), "Assert class not present" );\r
+});\r
+\r
test("removeAttr(String", function() {\r
ok( $('#mark').removeAttr("class")[0].className == "", "remove class" );\r
});\r
},
className: {
+ // internal only, use addClass("class")
add: function( elem, c ){
jQuery.each( c.split(/\s+/), function(i, cur){
if ( !jQuery.className.has( elem.className, cur ) )
elem.className += ( elem.className ? " " : "" ) + cur;
});
},
+ // internal only, use removeClass("class")
remove: function( elem, c ){
elem.className = c ?
jQuery.grep( elem.className.split(/\s+/), function(cur){
return !jQuery.className.has( c, cur );
}).join(' ') : "";
},
- has: function( classes, c ){
- return classes && new RegExp("(^|\\s)" + c + "(\\s|$)").test( classes );
+ // internal only, use is(".class")
+ has: function( t, c ) {
+ t = t.className || t;
+ return t && new RegExp("(^|\\s)" + c + "(\\s|$)").test( t );
}
},