[jQuery-es] ¿Como implementa jQuery ready?

stripTM fer en striptm.com
Dom Mayo 13 05:51:04 PDT 2007


Estoy mirando como hace para implementar jQuery el evento ready, pero no 
lo tengo claro, ya que parece que la primera vez que lo llamas deja el 
atributo isReady a true, y no le encuentro relación con la finalización 
de la carga del documento.



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
				jQuery.each( jQuery.readyList, function(){
					this.apply( document );
				});
				
				// Reset the list of functions
				jQuery.readyList = null;
			}
			// Remove event lisenter to avoid memory leak
			if ( jQuery.browser.mozilla || jQuery.browser.opera )
				document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
		}
	}
});


-- 
Saludos -=stripTM=-



Más información sobre la lista de distribución jquery-es