Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7217 closed bug (fixed)

.live and .delegate, multiple handlers

Reported by: [email protected] Owned by: dmethvin
Priority: low Milestone: 1.4.4
Component: event Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:


Given the code at http://jsfiddle.net/NxjMy/, on clicking 'click me', using jQuery 1.4.2, I get an alert 'foo' and nothing else, but with 1.4.3, I get two consecutive alerts: 'foo' and 'bar'.

This behaviour happens at least with recent versions of Firefox, Google Chrome and Opera. A similar thing happens with .live().

I could not find information about this change in the 1.4.3 release notes. What is going on?

Thanks, Bart

Change History (8)

comment:2 Changed 12 years ago by snover

Component: unfiledevent
Keywords: needsreview added

So I am pretty sure the behaviour in 1.4.2 was wrong; return false does not call stopImmediatePropagation and so should not prevent subsequent handlers on the same element from executing. On the other hand, manually calling stopImmediatePropagation does not work to stop subsequent handlers in 1.4.3. So, I’m going to mark this for further review.

comment:3 Changed 12 years ago by snover

Resolution: invalid
Status: newclosed

The behavior in 1.4.2 is wrong. 1.4.3 behaves correctly here.

comment:4 Changed 12 years ago by [email protected]

OK, thanks, so how do I get the desired behaviour, which is to prevent the second handler from being called?

comment:5 Changed 12 years ago by dmethvin

Keywords: needsreview removed
Priority: undecidedlow
Resolution: invalid
Status: closedreopened

OK, based on the test case here:


Looks like we need an isImmediatePropagationStopped in liveHandler. I'll put together a patch.

comment:7 Changed 12 years ago by dmethvin

Owner: set to dmethvin
Status: reopenedassigned

comment:8 Changed 12 years ago by dmethvin

Resolution: fixed
Status: assignedclosed

Honor stopImmediatePropagation for live/delegate event handlers. Fixes #7217.

Changeset: 974b5aeab7a3788ff5fb9db87b9567784e0249fc

Note: See TracTickets for help on using tickets.