Side navigation
#7217 closed bug (fixed)
Opened October 16, 2010 08:43PM UTC
Closed October 25, 2010 08:05PM UTC
Last modified March 19, 2012 09:19PM UTC
.live and .delegate, multiple handlers
Reported by: | b.w@xs4all.nl | Owned by: | dmethvin |
---|---|---|---|
Priority: | low | Milestone: | 1.4.4 |
Component: | event | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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
Attachments (0)
Change History (8)
Changed October 16, 2010 09:30PM UTC by comment:1
Changed October 17, 2010 12:12AM UTC by comment:2
component: | unfiled → event |
---|---|
keywords: | → needsreview |
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.
Changed October 22, 2010 12:31AM UTC by comment:3
resolution: | → invalid |
---|---|
status: | new → closed |
The behavior in 1.4.2 is wrong. 1.4.3 behaves correctly here.
Changed October 22, 2010 01:37PM UTC by comment:4
OK, thanks, so how do I get the desired behaviour, which is to prevent the second handler from being called?
Changed October 23, 2010 04:38PM UTC by comment:5
keywords: | needsreview |
---|---|
priority: | undecided → low |
resolution: | invalid |
status: | closed → reopened |
OK, based on the test case here:
http://forum.jquery.com/topic/e-stopimmedidatepropagation-does-not-work-with-live-or-with-delegate
Looks like we need an isImmediatePropagationStopped in liveHandler. I'll put together a patch.
Changed October 23, 2010 06:43PM UTC by comment:6
Changed October 23, 2010 06:54PM UTC by comment:7
owner: | → dmethvin |
---|---|
status: | reopened → assigned |
Maybe it's because of this commit?
http://github.com/jquery/jquery/commit/31432e048f879b93ffa44c39d6f5989ab2620bd8