Opened 12 years ago
Closed 12 years ago
#9446 closed bug (fixed)
Chained Deferred.pipe functions don't keep the original context from Deferred.resolveWith
Reported by: | Owned by: | jaubourg | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | deferred | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If I chain multiple pipes and use resolveWith
like so...
var defer = $.Deferred(); var promise = defer.pipe(function(x) { // `this` will be `obj` return x * 2; }).pipe(function(x) { // `this` will be `defer`? return x - 1; }); defer.resolveWith(obj, [5]);
...the first pipe function will get this
set to obj
as I expect, but the next function in the chain will get its context set back to the Deferred object. I would expect the context to be passed along the chain, so that the second pipe function also gets this
set to obj
.
Change History (3)
comment:1 Changed 12 years ago by
Cc: | jauborg added |
---|---|
Component: | unfiled → ajax |
Priority: | undecided → low |
comment:2 Changed 12 years ago by
Cc: | jauborg removed |
---|---|
Component: | ajax → deferred |
Owner: | set to jaubourg |
Status: | new → assigned |
comment:3 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
Fixes #9446. Context is properly propagated using pipe. If context was the original deferred, then context is updated to next deferred in the chain. Unit tests added.