aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/widget.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/ui/widget.js b/ui/widget.js
index b86232b73..edeb7fa6f 100644
--- a/ui/widget.js
+++ b/ui/widget.js
@@ -25,9 +25,16 @@ var widget_uuid = 0,
$.cleanData = (function( orig ) {
return function( elems ) {
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ var events, elem, i;
+ for ( i = 0; (elem = elems[i]) != null; i++ ) {
try {
- $( elem ).triggerHandler( "remove" );
+
+ // Only trigger remove when necessary to save time
+ events = $._data( elem, "events" );
+ if ( events && events.remove ) {
+ $( elem ).triggerHandler( "remove" );
+ }
+
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
}