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