Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an incompatible API of resolveWith & rejectWith. #15

Merged
merged 1 commit into from
Aug 4, 2013

Conversation

fukamachi
Copy link
Contributor

I'm not sure these are bugs, but I've found an incompatibility of resolveWith & rejectWith with jQuery.Deferred.

Try the following expressions on both of jQuery.Deferred & simply-deferred 2.2.0:

1. The return value

//   jQuery.Deferred: Returns a deferred object.
//   simply-deferred: Returns a Window object.
$.Deferred().resolveWith();

2. The arguments

//   jQuery.Deferred: Prints ['a', 'b'].
//   simply-deferred: Prints [['a', 'b']].
var deferred = $.Deferred();
deferred.promise().done(function() {
    console.log(arguments);
});
deferred.resolveWith(deferred, ['a', 'b']);

* resolveWith & rejectWith take `args` as an Array (See http://api.jquery.com/deferred.resolveWith/)
* resolveWith & rejectWith return a deferred object, not a Window object.

Try the following expressions on both of jQuery.Deferred &
simply-deferred 2.2.0:

    // 1. The return value
    //   jQuery.Deferred: Returns a deferred object.
    //   simply-deferred: Returns a Window object.
    $.Deferred().resolveWith();

    // 2. The arguments
    //   jQuery.Deferred: Prints ['a', 'b'].
    //   simply-deferred: Prints [['a', 'b']].
    var deferred = $.Deferred();
    deferred.promise().done(function() {
        console.log(arguments);
    });
    deferred.resolveWith(deferred, ['a', 'b']);
@sudhirj sudhirj merged commit 73e9d3e into sudhirj:master Aug 4, 2013
@sudhirj
Copy link
Owner

sudhirj commented Aug 4, 2013

Thanks for pointing that out... changing the behaviour, added specs and fixed in 2.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants