Make sure that the teardown is called after all the handlers of a type are removed. Fixes #6065.

This commit is contained in:
John Resig 2010-02-11 01:42:51 -05:00
parent 639f4931b0
commit 021b809ace
2 changed files with 7 additions and 3 deletions

View file

@ -221,7 +221,7 @@ jQuery.event = {
}
// remove generic event handler if no more handlers exist
if ( jQuery.isEmptyObject( events[ type ] ) ) {
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
removeEvent( elem, type, elemData.handle );
}