]> source.dussan.org Git - jquery.git/commitdiff
Ajax: remove deprecated extensions from ajax promise
authorOleg Gaidarenko <markelog@gmail.com>
Sun, 15 Feb 2015 02:41:38 +0000 (05:41 +0300)
committerOleg Gaidarenko <markelog@gmail.com>
Tue, 17 Feb 2015 06:58:45 +0000 (09:58 +0300)
Fixes gh-2084
Closes gh-2092

src/ajax.js
test/unit/ajax.js

index a9faee78d212489724450893c931e1915cea7051..70bb49691a592e2f55973dbc76efd305cb0fa939 100644 (file)
@@ -487,9 +487,7 @@ jQuery.extend({
                        };
 
                // Attach deferreds
-               deferred.promise( jqXHR ).complete = completeDeferred.add;
-               jqXHR.success = jqXHR.done;
-               jqXHR.error = jqXHR.fail;
+               deferred.promise( jqXHR );
 
                // Remove hash character (#7531: and string promotion)
                // Add protocol if not provided (prefilters might expect it)
@@ -619,9 +617,9 @@ jQuery.extend({
                strAbort = "abort";
 
                // Install callbacks on deferreds
-               for ( i in { success: 1, error: 1, complete: 1 } ) {
-                       jqXHR[ i ]( s[ i ] );
-               }
+               completeDeferred.add( s.complete );
+               jqXHR.done( s.success );
+               jqXHR.fail( s.error );
 
                // Get transport
                transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
index 20469d4e7c0358e36ffb92e5c500806e41bd6e0c..8a4ca7a657690aeb5c3208b5bbb9228e2e274227 100644 (file)
@@ -77,11 +77,11 @@ module( "ajax", {
                },
                success: true,
                afterSend: function( request ) {
-                       request.complete(function() {
+                       request.always(function() {
                                ok( true, "complete" );
-                       }).success(function() {
+                       }).done(function() {
                                ok( true, "success" );
-                       }).error(function() {
+                       }).fail(function() {
                                ok( false, "error" );
                        });
                }
@@ -95,11 +95,11 @@ module( "ajax", {
                },
                success: true,
                complete: function( xhr ) {
-                       xhr.complete(function() {
+                       xhr.always(function() {
                                ok( true, "complete" );
-                       }).success(function() {
+                       }).done(function() {
                                ok( true, "success" );
-                       }).error(function() {
+                       }).fail(function() {
                                ok( false, "error" );
                        });
                }