Skip to content

Commit

Permalink
Event: subtle change to remove
Browse files Browse the repository at this point in the history
  • Loading branch information
yan committed Aug 23, 2015
1 parent 1472290 commit a2092d8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) ) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a2092d8

Please sign in to comment.