Ticket #5779 (closed bug: fixed)
Bad behavior on .bind() with multiple events if one of them is special
| Reported by: | jarrowwx | Owned by: | brandon |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4.1 |
| Component: | event | Version: | 1.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
When you call bind with a space separated list of events, it loops through them as a shortcut for multiple calls to bind.
Unfortunately, if you call bind with a call to a special event, the code replaces the passed in handler with the one that is generated by the special event handler. This means that any other events in the list yet to be processed are altered in the process.
If the code were to differentiate between the original handler and the 'active' handler, and set the 'active' handler back to the original at the top of the loop, this problem would be solved.
Admittedly, it is an edge case, but the behavior is most definitely not what it should be. I've left the priority at the default value.
For more notes, see the thread in jquery-dev: "jQuery.event.special\['type'\].add modifies handler of other types"
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.

Fixed. http://github.com/jquery/jquery/commit/390186b902c4c1ac13e23754d33ed4d8b3d5fa38