Skip to content

Commit 8d7bfb4

Browse files
pobockskswedberg
authored andcommitted
jQuery.when(): Add "or Promise". Fixes jquery#145
1 parent aca4122 commit 8d7bfb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

entries/jQuery.when.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<pre><code>$.when( $.ajax("test.aspx") ).then(function(data, textStatus, jqXHR){
1414
alert( jqXHR.status ); // alerts 200
1515
});</code></pre>
16-
<p>If a single argument is passed to <code>jQuery.when</code> and it is not a Deferred, it will be treated as a resolved Deferred and any doneCallbacks attached will be executed immediately. The doneCallbacks are passed the original argument. In this case any failCallbacks you might set are never called since the Deferred is never rejected. For example:</p>
16+
<p>If a single argument is passed to <code>jQuery.when</code> and it is not a Deferred or a Promise, it will be treated as a resolved Deferred and any doneCallbacks attached will be executed immediately. The doneCallbacks are passed the original argument. In this case any failCallbacks you might set are never called since the Deferred is never rejected. For example:</p>
1717
<pre><code>$.when( { testing: 123 } ).done(
1818
function(x) { alert(x.testing); } /* alerts "123" */
1919
);</code></pre>

0 commit comments

Comments
 (0)