#9279 closed bug (fixed)
delegate() bind does not handle mouseover/mouseout and mouseenter/mouseout correctly for selected elements
| Reported by: | Owned by: | dmethvin | |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.7 |
| Component: | event | Version: | 1.6.1 |
| Keywords: | 1.7-discuss | Cc: | |
| Blocked by: | Blocking: |
Description (last modified by )
Affects Version 1.6.1 only, 1.6 works fine
Tested in Firefox(3.6) and Chrome Windows XP
May be related to Ticket #9069
Test Case:
<div id="test_box"> Test Box<br><br> <a href="#" class="test1">Test 1</a><br><br> <a href="#" class="test2">Test 2</a> </div> <script> $(document).ready(function() {
$("#test_box").delegate("a.test1", "mouseenter", function() { console.log('mouseenter'); }); $("#test_box").delegate("a.test1", "mouseleave", function() { console.log('mouseleave'); }); $("#test_box").delegate("a.test2", "mouseover", function() { console.log('mouseover'); }); $("#test_box").delegate("a.test2", "mouseout", function() { console.log('mouseout'); });
});
mousing over "Test 2" does not generate any output using 1.6.1 but works fine in older version including 1.6.
Also noticed if we assign all 4 mouse events with the same selector (a.test1), only mouseenter and mouseleave are fired.
Change History (20)
comment:1 Changed 8 years ago by
| Component: | unfiled → event |
|---|---|
| Owner: | set to thej3tan@… |
| Status: | new → pending |
comment:3 Changed 8 years ago by
| Priority: | undecided → low |
|---|---|
| Status: | new → open |
Confirmed. Works fine with 1.6 and below but there appears to be a regression in 1.6.1 where mouseover and mouseout aren't firing or being bound correctly.
comment:4 Changed 8 years ago by
This might be a little less cluttered for the basis of a unit/ref test
comment:5 Changed 8 years ago by
| Priority: | low → blocker |
|---|
comment:11 Changed 8 years ago by
| Description: | modified (diff) |
|---|
+1, although this is a bug not a feature.
comment:16 Changed 8 years ago by
This is almost certainly due to the changeset for #9069. Reverse-applying https://github.com/jquery/jquery/commit/419b5e5e2a0d376e71c3f37bf9a3d96f3b4a67f2 fixes this bug (but would also regress #9069, so darn).
comment:17 Changed 8 years ago by
| Description: | modified (diff) |
|---|
@hlian this bug is on the 1.7 fix list, so rest assured it will be dealt with for that release :)
comment:18 Changed 8 years ago by
| Milestone: | 1.next → 1.7 |
|---|---|
| Owner: | changed from thej3tan@… to dmethvin |
| Status: | open → assigned |
comment:19 Changed 8 years ago by
This code was reworked in 1.7, and yes there were issues that caused interference between mouseenter/leave and mouseover/out. I've created jquery/test/hovertest.html in the repo to verify all the cases work properly in 1.7 now.
comment:20 Changed 8 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, I've created this boilerplate: http://jsfiddle.net/rwaldron/da3nM/ Open the link and click to "Fork" in the top menu.