| @@ 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; |
|
| @@ 2228-2259 (lines=32) @@ | ||
| 2225 | return this; |
|
| 2226 | }, |
|
| 2227 | ||
| 2228 | removeClass: function( value ) { |
|
| 2229 | var classNames, i, l, elem, className, c, cl; |
|
| 2230 | ||
| 2231 | if ( jQuery.isFunction( value ) ) { |
|
| 2232 | return this.each(function( j ) { |
|
| 2233 | jQuery( this ).removeClass( value.call(this, j, this.className) ); |
|
| 2234 | }); |
|
| 2235 | } |
|
| 2236 | ||
| 2237 | if ( (value && typeof value === "string") || value === undefined ) { |
|
| 2238 | classNames = ( value || "" ).split( rspace ); |
|
| 2239 | ||
| 2240 | for ( i = 0, l = this.length; i < l; i++ ) { |
|
| 2241 | elem = this[ i ]; |
|
| 2242 | ||
| 2243 | if ( elem.nodeType === 1 && elem.className ) { |
|
| 2244 | if ( value ) { |
|
| 2245 | className = (" " + elem.className + " ").replace( rclass, " " ); |
|
| 2246 | for ( c = 0, cl = classNames.length; c < cl; c++ ) { |
|
| 2247 | className = className.replace(" " + classNames[ c ] + " ", " "); |
|
| 2248 | } |
|
| 2249 | elem.className = jQuery.trim( className ); |
|
| 2250 | ||
| 2251 | } else { |
|
| 2252 | elem.className = ""; |
|
| 2253 | } |
|
| 2254 | } |
|
| 2255 | } |
|
| 2256 | } |
|
| 2257 | ||
| 2258 | return this; |
|
| 2259 | }, |
|
| 2260 | ||
| 2261 | toggleClass: function( value, stateVal ) { |
|
| 2262 | var type = typeof value, |
|