diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2012-09-09 20:47:07 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-09-09 21:21:42 -0400 |
commit | 9b67b4c0ef311f96d6e035fd38bbfbe42a82b392 (patch) | |
tree | dbce43b905855701d4df6119e348ede2044e24b6 /src/event.js | |
parent | c79a533ffd3e063a498fde6bdb1b934c7b4b47ab (diff) | |
download | jquery-9b67b4c0ef311f96d6e035fd38bbfbe42a82b392.tar.gz jquery-9b67b4c0ef311f96d6e035fd38bbfbe42a82b392.zip |
Fix #12436, make delegated events fast again. Close gh-923.
Retains the rooted-at-delegateTarget behavior fixed in #12383 by afd717df9e.
Diffstat (limited to 'src/event.js')
-rw-r--r-- | src/event.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/event.js b/src/event.js index 902b2b5ff..d4c17cf31 100644 --- a/src/event.js +++ b/src/event.js @@ -81,6 +81,7 @@ jQuery.event = { handler: handler, guid: handler.guid, selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); @@ -393,7 +394,9 @@ jQuery.event = { sel = handleObj.selector; if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = jQuery( sel, this ).index( cur ) >= 0; + selMatch[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; } if ( selMatch[ sel ] ) { matches.push( handleObj ); |