| @@ 8842-8886 (lines=45) @@ | ||
| 8839 | return this; |
|
| 8840 | }, |
|
| 8841 | ||
| 8842 | removeClass: function( value ) { |
|
| 8843 | var classes, elem, cur, curValue, clazz, j, finalValue, |
|
| 8844 | i = 0; |
|
| 8845 | ||
| 8846 | if ( jQuery.isFunction( value ) ) { |
|
| 8847 | return this.each( function( j ) { |
|
| 8848 | jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
|
| 8849 | } ); |
|
| 8850 | } |
|
| 8851 | ||
| 8852 | if ( !arguments.length ) { |
|
| 8853 | return this.attr( "class", "" ); |
|
| 8854 | } |
|
| 8855 | ||
| 8856 | if ( typeof value === "string" && value ) { |
|
| 8857 | classes = value.match( rnotwhite ) || []; |
|
| 8858 | ||
| 8859 | while ( ( elem = this[ i++ ] ) ) { |
|
| 8860 | curValue = getClass( elem ); |
|
| 8861 | ||
| 8862 | // This expression is here for better compressibility (see addClass) |
|
| 8863 | cur = elem.nodeType === 1 && |
|
| 8864 | ( " " + curValue + " " ).replace( rclass, " " ); |
|
| 8865 | ||
| 8866 | if ( cur ) { |
|
| 8867 | j = 0; |
|
| 8868 | while ( ( clazz = classes[ j++ ] ) ) { |
|
| 8869 | ||
| 8870 | // Remove *all* instances |
|
| 8871 | while ( cur.indexOf( " " + clazz + " " ) > -1 ) { |
|
| 8872 | cur = cur.replace( " " + clazz + " ", " " ); |
|
| 8873 | } |
|
| 8874 | } |
|
| 8875 | ||
| 8876 | // Only assign if different to avoid unneeded rendering. |
|
| 8877 | finalValue = jQuery.trim( cur ); |
|
| 8878 | if ( curValue !== finalValue ) { |
|
| 8879 | jQuery.attr( elem, "class", finalValue ); |
|
| 8880 | } |
|
| 8881 | } |
|
| 8882 | } |
|
| 8883 | } |
|
| 8884 | ||
| 8885 | return this; |
|
| 8886 | }, |
|
| 8887 | ||
| 8888 | toggleClass: function( value, stateVal ) { |
|
| 8889 | var type = typeof value; |
|
| @@ 7403-7447 (lines=45) @@ | ||
| 7400 | return this; |
|
| 7401 | }, |
|
| 7402 | ||
| 7403 | removeClass: function( value ) { |
|
| 7404 | var classes, elem, cur, curValue, clazz, j, finalValue, |
|
| 7405 | i = 0; |
|
| 7406 | ||
| 7407 | if ( jQuery.isFunction( value ) ) { |
|
| 7408 | return this.each( function( j ) { |
|
| 7409 | jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
|
| 7410 | } ); |
|
| 7411 | } |
|
| 7412 | ||
| 7413 | if ( !arguments.length ) { |
|
| 7414 | return this.attr( "class", "" ); |
|
| 7415 | } |
|
| 7416 | ||
| 7417 | if ( typeof value === "string" && value ) { |
|
| 7418 | classes = value.match( rnotwhite ) || []; |
|
| 7419 | ||
| 7420 | while ( ( elem = this[ i++ ] ) ) { |
|
| 7421 | curValue = getClass( elem ); |
|
| 7422 | ||
| 7423 | // This expression is here for better compressibility (see addClass) |
|
| 7424 | cur = elem.nodeType === 1 && |
|
| 7425 | ( " " + curValue + " " ).replace( rclass, " " ); |
|
| 7426 | ||
| 7427 | if ( cur ) { |
|
| 7428 | j = 0; |
|
| 7429 | while ( ( clazz = classes[ j++ ] ) ) { |
|
| 7430 | ||
| 7431 | // Remove *all* instances |
|
| 7432 | while ( cur.indexOf( " " + clazz + " " ) > -1 ) { |
|
| 7433 | cur = cur.replace( " " + clazz + " ", " " ); |
|
| 7434 | } |
|
| 7435 | } |
|
| 7436 | ||
| 7437 | // Only assign if different to avoid unneeded rendering. |
|
| 7438 | finalValue = jQuery.trim( cur ); |
|
| 7439 | if ( curValue !== finalValue ) { |
|
| 7440 | elem.setAttribute( "class", finalValue ); |
|
| 7441 | } |
|
| 7442 | } |
|
| 7443 | } |
|
| 7444 | } |
|
| 7445 | ||
| 7446 | return this; |
|
| 7447 | }, |
|
| 7448 | ||
| 7449 | toggleClass: function( value, stateVal ) { |
|
| 7450 | var type = typeof value; |
|