jQuery 1.0.4 - New Wave Javascript(js源文件)

2019-06-03 09:49:42刘景俊

        // If the DOM is already ready
        if ( jQuery.isReady )
            // Execute the function immediately
            f.apply( document );

        // Otherwise, remember the function for later
        else {
            // Add the function to the wait list
            jQuery.readyList.push( f );
        }

        return this;
    }
});

jQuery.extend({
    /*
     * All the code that makes DOM Ready work nicely.
     */
    isReady: false,
    readyList: [],

    // Handle when the DOM is ready
    ready: function() {
        // Make sure that the DOM is not already loaded
        if ( !jQuery.isReady ) {
            // Remember that the DOM is ready
            jQuery.isReady = true;

            // If there are functions bound, to execute
            if ( jQuery.readyList ) {
                // Execute all of them
                for ( var i = 0; i < jQuery.readyList.length; i++ )
                    jQuery.readyList[i].apply( document );

                // Reset the list of functions
                jQuery.readyList = null;