Bug Tracker

Opened 12 years ago

Closed 12 years ago

#9414 closed bug (patchwelcome)

In IE 7/8 a div's mouseleave event fires from child open select element that extends below enclosing div

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: 1.next
Component: event Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:


I have a div containing a largeish select list. I've bound mouseenter and mouseleave events to the div via the .hover() method. When I open the select list it extends past the bottom of the div. In IE 7 and 8 the mouseleave event is fired when I move the mouse over the select list past the bottom of the enclosing div. Neither Chrome 11 nor Firefox 3.6 exhibit this behavior.

Not sure if this is a bug or enhancement. It could be argued either way.

The (currently) last answer @ http://stackoverflow.com/questions/2096843/funky-jquery-mouseleave-behavior does have a useful workaround that mostly does what I want although it does have the unfortunate deficiency in that it does not fire the mouseleave if the mouse leaves the boundary of the select dropdown.

function onMouseLeave(e) {

if (e &&

typeof e.fromElement != 'undefined' && typeof e.fromElement.length != 'undefined') {


} ... rest of my mouse leave handler


Change History (8)

comment:1 Changed 12 years ago by addyosmani

Owner: set to [email protected]
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on http://jsFiddle.net that reproduces the issue experienced to help us assess your ticket!

Additionally, test against the jQuery (edge) version to ensure the issue still exists.

comment:2 Changed 12 years ago by anonymous

Here's a simple example: http://jsfiddle.net/KTEax/

One thing that I noticed is that in this example the mouseleave is fired as soon as the cursor enters the dropdown list where I was seeing it fire when the cursor left the div while over the dropdown list. Either way it's not the behavior I was expecting.

comment:3 Changed 12 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 12 years ago by dwilks

Why didn't my comment from two weeks ago change the status from pending so you'd recognize that I'd replied? I'm assuming that making this comment won't re-open the bug since the section below only says "leave as closed."

comment:5 Changed 12 years ago by ajpiano

Resolution: invalid
Status: closedreopened

Because you replied as anonymous, not as dwilks :) I'll reopen.

comment:6 Changed 12 years ago by dmethvin

Component: unfiledevent
Priority: undecidedlow
Status: reopenedopen

Fixable via withinElement() maybe?

comment:7 Changed 12 years ago by Rick Waldron

@dmethvin I still have an open pull request for the withinElement re-write, I'l try to compare this issue with my patch sometime today (@ TXJS)

comment:8 Changed 12 years ago by dmethvin

Resolution: patchwelcome
Status: openclosed

In 1.7 I've rewritten the mouse* event handling but don't see a way to solve this one. If we throw away the mouseleave that you don't want at that point, the browser will never give us another. It's a case that's edgy enough to be solved by application code rather than in jQuery core.

I'll close the ticket as patchwelcome in case someone can come up with a solution I haven't thought of, but any patch should be small since fixing this doesn't justify a high size/performance cost.

Note: See TracTickets for help on using tickets.