Bug Tracker

Ticket #9279 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

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 4 years ago by rwaldron

  • Owner set to thej3tan@…
  • Status changed from new to pending
  • Component changed from unfiled to event

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 4 years ago by thej3tan@…

  • Status changed from pending to new

Reduced Test Case

 http://jsfiddle.net/ZE2Ug/3/

comment:3 Changed 4 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 4 years ago by rwaldron

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

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

comment:5 Changed 4 years ago by rwaldron

  • Priority changed from low to blocker

comment:6 Changed 4 years ago by rwaldron

#9312 is a duplicate of this ticket.

comment:7 Changed 4 years ago by john

  • Keywords 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:8 Changed 4 years ago by rwaldron

  • Description modified (diff)

+1, Seems like a bug, should be fixed

comment:9 Changed 4 years ago by jaubourg

+1, Bug bug bug

comment:10 Changed 4 years ago by timmywil

+1,

comment:11 Changed 4 years ago by dmethvin

  • Description modified (diff)

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

comment:12 Changed 3 years ago by john

  • Description modified (diff)

+1

comment:13 Changed 3 years ago by ajpiano

  • Description modified (diff)

+1, BUG should be fixed for 1.6.2

comment:14 Changed 3 years ago by scott.gonzalez

  • Description modified (diff)

+1

comment:15 Changed 3 years ago by scott.gonzalez

-1, cleverness != elegance

comment:16 Changed 3 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 3 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 3 years 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 3 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.