api.jquery.com icon indicating copy to clipboard operation
api.jquery.com copied to clipboard

Ajax example on when docs will fail with git build / 3.0

Open arschmitz opened this issue 8 years ago • 2 comments

https://api.jquery.com/jquery.when/

The first example resolves with multiple arguments which will fail on the git build and in upcoming 3.0 release because it uses then which no longer allows multiple args and will resolve with an array now in this case.

It's also a bad example as it lack error handling

arschmitz avatar Mar 28 '16 16:03 arschmitz

I think we should keep the example because people might rely on it and maintainers of projects using our previous versions might want to understand the pattern. My proposal is to add a fail() call to the existing example and add a change in branch v3 with a single argument. We should also add an explanation of what is changed.

AurelioDeRosa avatar Apr 12 '16 20:04 AurelioDeRosa

The only reason I'd want to keep it is to explain that people should not do it. That's fine though. Any call like $.when( something-that-is-always-a-Deferred ) doesn't need $.when in the first place so we can explain that.

dmethvin avatar Apr 13 '16 12:04 dmethvin