0
|
1 //>>excludeStart("exclude", pragmas.exclude);
|
|
2 define([ "shoestring" ], function(){
|
|
3 //>>excludeEnd("exclude");
|
|
4
|
|
5 /**
|
|
6 * Remove a class from each DOM element in the set of elements.
|
|
7 *
|
|
8 * @param {string} className The name of the class to be removed.
|
|
9 * @return shoestring
|
|
10 * @this shoestring
|
|
11 */
|
|
12 shoestring.fn.removeClass = function( cname ){
|
|
13 var classes = cname.replace(/^\s+|\s+$/g, '').split( " " );
|
|
14
|
|
15 return this.each(function(){
|
|
16 var newClassName, regex;
|
|
17
|
|
18 for( var i = 0, il = classes.length; i < il; i++ ){
|
|
19 if( this.className !== undefined ){
|
|
20 regex = new RegExp( "(^|\\s)" + classes[ i ] + "($|\\s)", "gmi" );
|
|
21 newClassName = this.className.replace( regex, " " );
|
|
22
|
|
23 this.className = newClassName.replace(/^\s+|\s+$/g, '');
|
|
24 }
|
|
25 }
|
|
26 });
|
|
27 };
|
|
28
|
|
29 //>>excludeStart("exclude", pragmas.exclude);
|
|
30 });
|
|
31 //>>excludeEnd("exclude");
|