@@ 8804-8840 (lines=37) @@ | ||
8801 | } |
|
8802 | ||
8803 | jQuery.fn.extend( { |
|
8804 | addClass: function( value ) { |
|
8805 | var classes, elem, cur, curValue, clazz, j, finalValue, |
|
8806 | i = 0; |
|
8807 | ||
8808 | if ( jQuery.isFunction( value ) ) { |
|
8809 | return this.each( function( j ) { |
|
8810 | jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
|
8811 | } ); |
|
8812 | } |
|
8813 | ||
8814 | if ( typeof value === "string" && value ) { |
|
8815 | classes = value.match( rnotwhite ) || []; |
|
8816 | ||
8817 | while ( ( elem = this[ i++ ] ) ) { |
|
8818 | curValue = getClass( elem ); |
|
8819 | cur = elem.nodeType === 1 && |
|
8820 | ( " " + curValue + " " ).replace( rclass, " " ); |
|
8821 | ||
8822 | if ( cur ) { |
|
8823 | j = 0; |
|
8824 | while ( ( clazz = classes[ j++ ] ) ) { |
|
8825 | if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
|
8826 | cur += clazz + " "; |
|
8827 | } |
|
8828 | } |
|
8829 | ||
8830 | // only assign if different to avoid unneeded rendering. |
|
8831 | finalValue = jQuery.trim( cur ); |
|
8832 | if ( curValue !== finalValue ) { |
|
8833 | jQuery.attr( elem, "class", finalValue ); |
|
8834 | } |
|
8835 | } |
|
8836 | } |
|
8837 | } |
|
8838 | ||
8839 | return this; |
|
8840 | }, |
|
8841 | ||
8842 | removeClass: function( value ) { |
|
8843 | var classes, elem, cur, curValue, clazz, j, finalValue, |
@@ 7365-7401 (lines=37) @@ | ||
7362 | } |
|
7363 | ||
7364 | jQuery.fn.extend( { |
|
7365 | addClass: function( value ) { |
|
7366 | var classes, elem, cur, curValue, clazz, j, finalValue, |
|
7367 | i = 0; |
|
7368 | ||
7369 | if ( jQuery.isFunction( value ) ) { |
|
7370 | return this.each( function( j ) { |
|
7371 | jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
|
7372 | } ); |
|
7373 | } |
|
7374 | ||
7375 | if ( typeof value === "string" && value ) { |
|
7376 | classes = value.match( rnotwhite ) || []; |
|
7377 | ||
7378 | while ( ( elem = this[ i++ ] ) ) { |
|
7379 | curValue = getClass( elem ); |
|
7380 | cur = elem.nodeType === 1 && |
|
7381 | ( " " + curValue + " " ).replace( rclass, " " ); |
|
7382 | ||
7383 | if ( cur ) { |
|
7384 | j = 0; |
|
7385 | while ( ( clazz = classes[ j++ ] ) ) { |
|
7386 | if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
|
7387 | cur += clazz + " "; |
|
7388 | } |
|
7389 | } |
|
7390 | ||
7391 | // Only assign if different to avoid unneeded rendering. |
|
7392 | finalValue = jQuery.trim( cur ); |
|
7393 | if ( curValue !== finalValue ) { |
|
7394 | elem.setAttribute( "class", finalValue ); |
|
7395 | } |
|
7396 | } |
|
7397 | } |
|
7398 | } |
|
7399 | ||
7400 | return this; |
|
7401 | }, |
|
7402 | ||
7403 | removeClass: function( value ) { |
|
7404 | var classes, elem, cur, curValue, clazz, j, finalValue, |