Ticket #11511 (closed enhancement: invalid)
delay should not cause the second argument to be called if it's a function
| Reported by: | chrif | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I see in this ticket: http://bugs.jquery.com/ticket/8489 that delay will not have a callback as its second argument. Problem is if someone overlooks the doc and try to use it as a callback, it actually gets called anyway at the first dequeue: https://github.com/jquery/jquery/blob/master/src/queue.js#L89 but not at the subsequent ones: http://jsfiddle.net/KcXVv/1/
It can lead to code hard to debug. If it works the first time, you might think you got the arguments right and overlook the doc.
Maybe something like that: https://github.com/chrif/jquery/commit/97b4e456ce535fc008c2a2cb6e45e297d76be2c2#src/queue.js
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Overlooking the docs is not a bug in jQuery, especially when the docs are very clear: http://api.jquery.com/delay/