@@ 2191-2226 (lines=36) @@ | ||
2188 | }); |
|
2189 | }, |
|
2190 | ||
2191 | addClass: function( value ) { |
|
2192 | var classNames, i, l, elem, |
|
2193 | setClass, c, cl; |
|
2194 | ||
2195 | if ( jQuery.isFunction( value ) ) { |
|
2196 | return this.each(function( j ) { |
|
2197 | jQuery( this ).addClass( value.call(this, j, this.className) ); |
|
2198 | }); |
|
2199 | } |
|
2200 | ||
2201 | if ( value && typeof value === "string" ) { |
|
2202 | classNames = value.split( rspace ); |
|
2203 | ||
2204 | for ( i = 0, l = this.length; i < l; i++ ) { |
|
2205 | elem = this[ i ]; |
|
2206 | ||
2207 | if ( elem.nodeType === 1 ) { |
|
2208 | if ( !elem.className && classNames.length === 1 ) { |
|
2209 | elem.className = value; |
|
2210 | ||
2211 | } else { |
|
2212 | setClass = " " + elem.className + " "; |
|
2213 | ||
2214 | for ( c = 0, cl = classNames.length; c < cl; c++ ) { |
|
2215 | if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { |
|
2216 | setClass += classNames[ c ] + " "; |
|
2217 | } |
|
2218 | } |
|
2219 | elem.className = jQuery.trim( setClass ); |
|
2220 | } |
|
2221 | } |
|
2222 | } |
|
2223 | } |
|
2224 | ||
2225 | return this; |
|
2226 | }, |
|
2227 | ||
2228 | removeClass: function( value ) { |
|
2229 | var classNames, i, l, elem, className, c, cl; |
@@ 1729-1763 (lines=35) @@ | ||
1726 | }); |
|
1727 | }, |
|
1728 | ||
1729 | addClass: function( value ) { |
|
1730 | if ( jQuery.isFunction(value) ) { |
|
1731 | return this.each(function(i) { |
|
1732 | var self = jQuery(this); |
|
1733 | self.addClass( value.call(this, i, self.attr("class")) ); |
|
1734 | }); |
|
1735 | } |
|
1736 | ||
1737 | if ( value && typeof value === "string" ) { |
|
1738 | var classNames = (value || "").split( rspaces ); |
|
1739 | ||
1740 | for ( var i = 0, l = this.length; i < l; i++ ) { |
|
1741 | var elem = this[i]; |
|
1742 | ||
1743 | if ( elem.nodeType === 1 ) { |
|
1744 | if ( !elem.className ) { |
|
1745 | elem.className = value; |
|
1746 | ||
1747 | } else { |
|
1748 | var className = " " + elem.className + " ", |
|
1749 | setClass = elem.className; |
|
1750 | ||
1751 | for ( var c = 0, cl = classNames.length; c < cl; c++ ) { |
|
1752 | if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { |
|
1753 | setClass += " " + classNames[c]; |
|
1754 | } |
|
1755 | } |
|
1756 | elem.className = jQuery.trim( setClass ); |
|
1757 | } |
|
1758 | } |
|
1759 | } |
|
1760 | } |
|
1761 | ||
1762 | return this; |
|
1763 | }, |
|
1764 | ||
1765 | removeClass: function( value ) { |
|
1766 | if ( jQuery.isFunction(value) ) { |