I've been going through the documentation for the deferred objects API, and one thing that's still not clear to me is : what jQuery functions are returning a deferred object?
The documentation seems to say that jQuery.ajax() and the animation functions like jQuery.fadeIn() does (what about jQuery UI effects?), but the pages for those functions say they return a jqXHR object and a plain jQuery object.
Can I do this for example?
var firstResult = $("#myDiv").css("color", 'red'); // Plain function
var secondResult = $.ajax("foobar.php"); // Ajax function
var thirdResult = $("#someOtherDiv").fadeIn('slow'); // Animation function
$.when(firstResult, secondResult, thirdResult).done(alert("It's all over."));
As I understood it, jQuery.when() can be used with even not deferred functions. They will just be considered as already resolved. But still, which functions are considered as deferred?
I think the documentation should be made clearer about that.