Skip to main content

Bug Tracker

Side navigation

#5259 closed enhancement (fixed)

Opened September 16, 2009 07:58PM UTC

Closed November 09, 2009 12:03PM UTC

[patch] Event delegation for mouseenter and mouseleave

Reported by: lrbabe Owned by: brandon
Priority: major Milestone: 1.4
Component: event Version: 1.3.2
Keywords: delegation Cc:
Blocked by: Blocking:
Description

This patch adds a private "delegate" function used to bypass "withinElement" in case of event delegation and adds an extra test for the event.relatedTarget in liveHandler for the mouseenter and mouseleave events.

Attachments (1)
  • patchEvent.txt (1.7 KB) - added by lrbabe September 16, 2009 08:27PM UTC.
Change History (2)

Changed November 03, 2009 11:45PM UTC by lrbabe comment:1

I've sent a pull request through github. My repository is here: http://github.com/lrbabe/jquery/tree/5fd21143b445bb6e814eb6e54783dac71405e524

Changed November 09, 2009 12:03PM UTC by john comment:2

resolution: → fixed
status: newclosed

Landed the updated version:

http://github.com/jquery/jquery/commit/d251809912c06478fd0c7711736ef6ea3572723e

I had to do it by hand because there were still some whitespace problems.

Also, in the case where you do:

if ( fn.live === "mouseenter" || fn.live === "mouseleave" ) {

would it be possible to do:

if ( event.relatedTarget ) {

instead? It'd be nice to have this code be generally generic.