Commit 9b67b4c0 authored by Dave Methvin's avatar Dave Methvin

Fix #12436, make delegated events fast again. Close gh-923.

Retains the rooted-at-delegateTarget behavior fixed in #12383 by afd717df.
parent c79a533f
...@@ -81,6 +81,7 @@ jQuery.event = { ...@@ -81,6 +81,7 @@ jQuery.event = {
handler: handler, handler: handler,
guid: handler.guid, guid: handler.guid,
selector: selector, selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".") namespace: namespaces.join(".")
}, handleObjIn ); }, handleObjIn );
...@@ -393,7 +394,9 @@ jQuery.event = { ...@@ -393,7 +394,9 @@ jQuery.event = {
sel = handleObj.selector; sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) { 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 ] ) { if ( selMatch[ sel ] ) {
matches.push( handleObj ); matches.push( handleObj );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment