From da966573c3f3cb083c48cd3ead88e7542937d4df Mon Sep 17 00:00:00 2001 From: jeresig Date: Sat, 13 Feb 2010 06:10:43 -0500 Subject: Make sure that elements that have been removed also have their special events cleaned up. Fixes #6084. --- src/manipulation.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/manipulation.js') diff --git a/src/manipulation.js b/src/manipulation.js index a58e52b6a..4e7a31ed4 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -547,7 +547,7 @@ jQuery.extend({ }, cleanData: function( elems ) { - var data, id, cache = jQuery.cache; + var data, id, cache = jQuery.cache, special = jQuery.event.special; for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { id = elem[ jQuery.expando ]; @@ -556,8 +556,13 @@ jQuery.extend({ data = cache[ id ]; if ( data.events ) { - for ( var event in data.events ) { - removeEvent( elem, event, data.handle ); + for ( var type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + } else { + removeEvent( elem, type, data.handle ); + } } } -- cgit v1.2.3