Replaces jQuery._Deferred with the much more flexible (and public) jQuery.Callbacks. Hopefully, jQuery.Callbacks can be used as a base for all callback lists needs in jQuery. Also adds progress callbacks to Deferreds (handled in jQuery.when too). Needs more unit tests.
This commit is contained in:
parent
f7f8450041
commit
114846d38d
15 changed files with 316 additions and 272 deletions
|
@ -50,7 +50,7 @@ var jQuery = function( selector, context ) {
|
|||
// For matching the engine and version of the browser
|
||||
browserMatch,
|
||||
|
||||
// The deferred used on DOM ready
|
||||
// The callback list used on DOM ready
|
||||
readyList,
|
||||
|
||||
// The ready event handler
|
||||
|
@ -249,7 +249,7 @@ jQuery.fn = jQuery.prototype = {
|
|||
jQuery.bindReady();
|
||||
|
||||
// Add the callback
|
||||
readyList.done( fn );
|
||||
readyList.add( fn );
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -404,7 +404,7 @@ jQuery.extend({
|
|||
}
|
||||
|
||||
// If there are functions bound, to execute
|
||||
readyList.resolveWith( document, [ jQuery ] );
|
||||
readyList.fireWith( document, [ jQuery ] );
|
||||
|
||||
// Trigger any bound ready events
|
||||
if ( jQuery.fn.trigger ) {
|
||||
|
@ -418,7 +418,7 @@ jQuery.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
readyList = jQuery._Deferred();
|
||||
readyList = jQuery.Callbacks( "once memory" );
|
||||
|
||||
// Catch cases where $(document).ready() is called after the
|
||||
// browser event has already occurred.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue