Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#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:
Blocked by: Blocking:

Description (last modified by Rick Waldron)

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 12 years ago by Rick Waldron

Component: unfiledevent
Owner: set to thej3tan@…
Status: newpending

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.

comment:2 Changed 12 years ago by thej3tan@…

Status: pendingnew

comment:3 Changed 12 years ago by addyosmani

Priority: undecidedlow
Status: newopen

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 12 years ago by Rick Waldron

This might be a little less cluttered for the basis of a unit/ref test

http://jsfiddle.net/rwaldron/vACb2/

comment:5 Changed 12 years ago by Rick Waldron

Priority: lowblocker

comment:6 Changed 12 years ago by Rick Waldron

#9312 is a duplicate of this ticket.

comment:7 Changed 12 years ago by john

Keywords: 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:8 Changed 12 years ago by Rick Waldron

Description: modified (diff)

+1, Seems like a bug, should be fixed

comment:9 Changed 12 years ago by jaubourg

+1, Bug bug bug

comment:10 Changed 12 years ago by Timmy Willison

+1,

comment:11 Changed 12 years ago by dmethvin

Description: modified (diff)

+1, although this is a bug not a feature.

comment:12 Changed 12 years ago by john

Description: modified (diff)

+1

comment:13 Changed 12 years ago by ajpiano

Description: modified (diff)

+1, BUG should be fixed for 1.6.2

comment:14 Changed 12 years ago by scottgonzalez

Description: modified (diff)

+1

comment:15 Changed 12 years ago by scottgonzalez

-1, cleverness != elegance

comment:16 Changed 12 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 12 years ago by Rick Waldron

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 12 years ago by dmethvin

Milestone: 1.next1.7
Owner: changed from thej3tan@… to dmethvin
Status: openassigned

comment:19 Changed 12 years 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.

Note: See TracTickets for help on using tickets.