Question about jQuery source code (addClass)
<p>Can you explain the following logic inside "if ( jQuery.isFunction( value ))" inside addClass? I don't understand what its purpose. Thanks.</p>

<pre><code>addClass: function( value ) {

        var classNames, i, l, elem,
            setClass, c, cl;

        if ( jQuery.isFunction( value ) ) {
            return this.each(function( j ) {
                jQuery( this ).addClass( value.call(this, j, this.className) );
            });
        }

        if ( value &amp;&amp; typeof value === "string" ) {
            classNames = value.split( rspace );

            for ( i = 0, l = this.length; i &lt; l; i++ ) {
                elem = this[ i ];

                if ( elem.nodeType === 1 ) {
                    if ( !elem.className &amp;&amp; classNames.length === 1 ) {
                        elem.className = value;

                    } else {
                        setClass = " " + elem.className + " ";

                        for ( c = 0, cl = classNames.length; c &lt; cl; c++ ) {
                            if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
                                setClass += classNames[ c ] + " ";
                            }
                        }
                        elem.className = jQuery.trim( setClass );
                    }
                }
            }
        }

        return this;
    },
</code></pre>
