Permalink
Browse files

Event: subtle change to remove

  • Loading branch information...
1 parent 1472290 commit a2092d8a85474c90e2e4d306a21a14af55365b58 yan committed Aug 23, 2015
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/event.js
View
@@ -157,7 +157,7 @@ jQuery.event = {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
- namespaces, origType,
+ namespaces, origType, spliced,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
@@ -190,19 +190,21 @@ jQuery.event = {
while ( j-- ) {
handleObj = handlers[ j ];
- if ( ( mappedTypes || origType === handleObj.origType ) &&
+ spliced = ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
- ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
- handlers.splice( j, 1 );
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) &&
+ handlers.splice( j, 1 );
+ if ( spliced && spliced.length > 0 ) {
+ // Will never be reached when processed by uglify-js@2.4.23!
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
- }
+ }
}
// Remove generic event handler if we removed something and no more handlers exist

0 comments on commit a2092d8

Please sign in to comment.