diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 578d330ba33..b486aa9fdad 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -322,8 +322,13 @@ $.Widget.prototype = { $( this ).hasClass( "ui-state-disabled" ) ) { return; } - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); + // return ( typeof handler === "string" ? instance[ handler ] : handler ) + // .apply( instance, arguments ); + // bugfix memory leak http://bugs.jqueryui.com/ticket/7808 + var ret = ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + instance = null; + return ret; } var match = event.match( /^(\w+)\s*(.*)$/ ), eventName = match[1] + "." + instance.widgetName, @@ -333,6 +338,8 @@ $.Widget.prototype = { } else { element.bind( eventName, handlerProxy ); } + // bugfix memory leak http://bugs.jqueryui.com/ticket/7808 + element = null; }); },