Ticket #9279 (closed bug: fixed)
delegate() bind does not handle mouseover/mouseout and mouseenter/mouseout correctly for selected elements
| Reported by: | thej3tan@… | Owned by: | dmethvin |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.7 |
| Component: | event | Version: | 1.6.1 |
| Keywords: | 1.7-discuss | Cc: | |
| Blocking: | Blocked by: |
Description (last modified by rwaldron) (diff)
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
comment:1 Changed 2 years ago by rwaldron
- Owner set to thej3tan@…
- Status changed from new to pending
- Component changed from unfiled to event
comment:3 Changed 2 years ago by addyosmani
- Priority changed from undecided to low
- Status changed from new to 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 2 years ago by rwaldron
This might be a little less cluttered for the basis of a unit/ref test
comment:7 Changed 2 years ago by john
- Keywords 1.7-discuss added
Nominating ticket for 1.7 discussion.
comment:8 Changed 2 years ago by rwaldron
- Description modified (diff)
+1, Seems like a bug, should be fixed
comment:10 Changed 2 years ago by timmywil
+1,
comment:11 Changed 2 years ago by dmethvin
- Description modified (diff)
+1, although this is a bug not a feature.
comment:13 Changed 2 years ago by ajpiano
- Description modified (diff)
+1, BUG should be fixed for 1.6.2
comment:15 Changed 2 years ago by scott.gonzalez
-1, cleverness != elegance
comment:16 Changed 2 years ago by hlian
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 2 years ago by rwaldron
- 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 23 months ago by dmethvin
- Owner changed from thej3tan@… to dmethvin
- Status changed from open to assigned
- Milestone changed from 1.next to 1.7
comment:19 Changed 21 months ago by dmethvin
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 20 months ago by dmethvin
- Status changed from assigned to closed
- Resolution set to fixed
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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.