aboutsummaryrefslogtreecommitdiffstats
path: root/src/deferred.js
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2012-12-07 15:14:12 +0100
committerjaubourg <j@ubourg.net>2012-12-07 15:14:12 +0100
commit23d7cf0488bfeaab51d8f55435cab01f5cf990ca (patch)
treee05a56e92c282eb0b993f46202ab02bc609456fd /src/deferred.js
parent282c044d64e366d1bcb76d7d4f49c54098c6547f (diff)
downloadjquery-23d7cf0488bfeaab51d8f55435cab01f5cf990ca.tar.gz
jquery-23d7cf0488bfeaab51d8f55435cab01f5cf990ca.zip
Deferred: .resolve(), .reject() and .notify() now set the callback context to the promise instance rather than the deferred instance ; .then() has also been amended. Fixes #11405.
Diffstat (limited to 'src/deferred.js')
-rw-r--r--src/deferred.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/deferred.js b/src/deferred.js
index e525fc068..d84206570 100644
--- a/src/deferred.js
+++ b/src/deferred.js
@@ -32,7 +32,7 @@ jQuery.extend({
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
- newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, [ returned ] );
}
} :
newDefer[ action ]
@@ -70,8 +70,11 @@ jQuery.extend({
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
- // deferred[ resolve | reject | notify ] = list.fire
- deferred[ tuple[0] ] = list.fire;
+ // deferred[ resolve | reject | notify ]
+ deferred[ tuple[0] ] = function() {
+ deferred[ tuple[0] + "With" ]( promise, arguments );
+ return this;
+ };
deferred[ tuple[0] + "With" ] = list.fireWith;
});