diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2011-11-15 11:38:55 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2011-11-15 11:38:55 -0500 |
commit | ca8fc725ac8f590fff965e70c270c53ab0a6c0f3 (patch) | |
tree | 9186f411482a7a4342a432a242e9378059bcb43c /src | |
parent | 6736dd7168ccd1e6d72aca2e3c89d685c5d9c63a (diff) | |
download | jquery-ca8fc725ac8f590fff965e70c270c53ab0a6c0f3.tar.gz jquery-ca8fc725ac8f590fff965e70c270c53ab0a6c0f3.zip |
Allow mapped types to be removed by a namespace-only type name.
Diffstat (limited to 'src')
-rw-r--r-- | src/event.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/event.js b/src/event.js index 199110c00..c9c891992 100644 --- a/src/event.js +++ b/src/event.js @@ -148,7 +148,7 @@ jQuery.event = { global: {}, // Detach an event or set of events from an element - remove: function( elem, types, handler, selector ) { + remove: function( elem, types, handler, selector, mappedTypes ) { var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), t, tns, type, origType, namespaces, origCount, @@ -167,9 +167,8 @@ jQuery.event = { // Unbind all events (on this namespace, if provided) for the element if ( !type ) { - namespaces = namespaces? "." + namespaces : ""; - for ( j in events ) { - jQuery.event.remove( elem, j + namespaces, handler, selector ); + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } @@ -184,7 +183,7 @@ jQuery.event = { for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; - if ( origType === handleObj.origType && + if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !namespaces || namespaces.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { |