]> source.dussan.org Git - jquery.git/commitdiff
Renamed "complete" to "done" in order to avoid conflicts with jXHR.complete.
authorjaubourg <j@ubourg.net>
Thu, 6 Jan 2011 00:26:06 +0000 (01:26 +0100)
committerjaubourg <j@ubourg.net>
Thu, 6 Jan 2011 00:26:06 +0000 (01:26 +0100)
src/ajax.js
src/core.js
test/unit/core.js

index d78542d02ebe4dc4ba78aea62891d05ca589a901..7988ab1ef0f861a253261bd52dfe661f69bb9b29 100644 (file)
@@ -496,9 +496,9 @@ jQuery.extend({
 
                // Attach deferreds
                deferred.promise( jXHR );
-               jXHR.success = jXHR.complete;
+               jXHR.success = jXHR.done;
                jXHR.error = jXHR.fail;
-               jXHR.complete = completeDeferred.complete;
+               jXHR.complete = completeDeferred.done;
 
                // Remove hash character (#7531: and string promotion)
                s.url = ( "" + s.url ).replace( rhash , "" );
index 77f9fcebd17110b06235c4e054f59fbc9674435c..b9e6d816f07b261741b181b4fb8de684b7818ef4 100644 (file)
@@ -258,7 +258,7 @@ jQuery.fn = jQuery.prototype = {
                jQuery.bindReady();
 
                // Change ready & apply
-               return ( jQuery.fn.ready = readyList.complete ).apply( this , arguments );
+               return ( jQuery.fn.ready = readyList.done ).apply( this , arguments );
        },
 
        eq: function( i ) {
@@ -815,8 +815,8 @@ jQuery.extend({
                        // the deferred itself
                        deferred  = {
 
-                               // complete( f1, f2, ...)
-                               complete: function () {
+                               // done( f1, f2, ...)
+                               done: function () {
 
                                        if ( ! cancelled ) {
 
@@ -836,7 +836,7 @@ jQuery.extend({
                                                        elem = args[ i ];
                                                        type = jQuery.type( elem );
                                                        if ( type === "array" ) {
-                                                               deferred.complete.apply( deferred , elem );
+                                                               deferred.done.apply( deferred , elem );
                                                        } else if ( type === "function" ) {
                                                                callbacks.push( elem );
                                                        }
@@ -901,11 +901,11 @@ jQuery.extend({
                // Add errorDeferred methods and redefine cancel
                jQuery.extend( deferred , {
 
-                       then: function( completeCallbacks , failCallbacks ) {
-                               deferred.complete( completeCallbacks ).fail( failCallbacks );
+                       then: function( doneCallbacks , failCallbacks ) {
+                               deferred.done( doneCallbacks ).fail( failCallbacks );
                                return this;
                        },
-                       fail: failDeferred.complete,
+                       fail: failDeferred.done,
                        fireReject: failDeferred.fire,
                        reject: failDeferred.resolve,
                        isRejected: failDeferred.isResolved,
@@ -913,7 +913,7 @@ jQuery.extend({
                        // If obj is provided, the promise aspect is added to the object
                        promise: function( obj ) {
                                obj = obj || {};
-                               jQuery.each( "then complete fail isResolved isRejected".split( " " ) , function( _ , method ) {
+                               jQuery.each( "then done fail isResolved isRejected".split( " " ) , function( _ , method ) {
                                        obj[ method ] = deferred[ method ];
                                });
                                obj.promise = function() {
index ef06e7ac26cc24bc0f6ea3e052496245e10d667d..8fd060578d6e97e10261e49b2c8409d8b0a75766 100644 (file)
@@ -915,7 +915,7 @@ test("jQuery._Deferred()", function() {
 
        test = false;
 
-       deferred.complete( function( value ) {
+       deferred.done( function( value ) {
                equals( value , "value" , "Test pre-resolve callback" );
                test = true;
        } );
@@ -926,7 +926,7 @@ test("jQuery._Deferred()", function() {
 
        test = false;
 
-       deferred.complete( function( value ) {
+       deferred.done( function( value ) {
                equals( value , "value" , "Test post-resolve callback" );
                test = true;
        } );
@@ -937,7 +937,7 @@ test("jQuery._Deferred()", function() {
 
        test = true;
 
-       deferred.complete( function() {
+       deferred.done( function() {
                ok( false , "Cancel was ignored" );
                test = false;
        } );
@@ -947,18 +947,18 @@ test("jQuery._Deferred()", function() {
        deferred = jQuery._Deferred().resolve();
 
        try {
-               deferred.complete( function() {
+               deferred.done( function() {
                        throw "Error";
                } , function() {
                        ok( true , "Test deferred do not cancel on exception" );
                } );
        } catch( e ) {
                strictEqual( e , "Error" , "Test deferred propagates exceptions");
-               deferred.complete();
+               deferred.done();
        }
 
        test = "";
-       deferred = jQuery._Deferred().complete( function() {
+       deferred = jQuery._Deferred().done( function() {
 
                test += "A";
 
@@ -968,13 +968,13 @@ test("jQuery._Deferred()", function() {
 
        } ).resolve();
 
-       strictEqual( test , "AB" , "Test multiple complete parameters" );
+       strictEqual( test , "AB" , "Test multiple done parameters" );
 
        test = "";
 
-       deferred.complete( function() {
+       deferred.done( function() {
 
-               deferred.complete( function() {
+               deferred.done( function() {
 
                        test += "C";
 
@@ -987,11 +987,11 @@ test("jQuery._Deferred()", function() {
                test += "B";
        } );
 
-       strictEqual( test , "ABC" , "Test complete callbacks order" );
+       strictEqual( test , "ABC" , "Test done callbacks order" );
 
        deferred = jQuery._Deferred();
 
-       deferred.fire( jQuery , [ document ] ).complete( function( doc ) {
+       deferred.fire( jQuery , [ document ] ).done( function( doc ) {
                ok( this === jQuery && arguments.length === 1 && doc === document , "Test fire context & args" );
        });
 });