Makes the promise method of Deferreds a bit more readable by not using the variable declared as parameter trick anymore.

This commit is contained in:
jaubourg 2011-02-22 00:44:22 +01:00
parent d5f7711ce0
commit e405419fb7

View file

@ -890,14 +890,14 @@ jQuery.extend({
isRejected: failDeferred.isResolved,
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj , i /* internal */ ) {
promise: function( obj ) {
if ( obj == null ) {
if ( promise ) {
return promise;
}
promise = obj = {};
}
i = promiseMethods.length;
var i = promiseMethods.length;
while( i-- ) {
obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ];
}