Permalink
Browse files

ui.widget: modified _createWidget method and added __destroy method. …

…Fixed #7808 - ui.widget Memory (private bytes of IE process) increases when create and destroy of the simple widget are repeated.
  • Loading branch information...
1 parent f11dab3 commit d2e603d28dfbb73029ef5621e188a35c79169525 @Y-Kamata committed Nov 2, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 ui/jquery.ui.widget.js
View
@@ -195,6 +195,11 @@ $.Widget.prototype = {
if ( element !== this ) {
$.data( element, this.widgetName, this );
this._bind({ remove: "destroy" });
+ // bugfix memory leak http://bugs.jqueryui.com/ticket/7808
+ this.element.bind( "remove." + this.widgetName,
+ {widgetName: this.widgetName},
+ this.__destroy);
+
this.document = $( element.ownerDocument );
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
}
@@ -203,6 +208,11 @@ $.Widget.prototype = {
this._trigger( "create" );
this._init();
},
+ // bugfix memory leak http://bugs.jqueryui.com/ticket/7808
+ $.Widget.prototype.__destroy = function(e){
+ var self = $(this).data(e.data.widgetName);
+ self.destroy();
+ },
_getCreateOptions: $.noop,
_create: $.noop,
_init: $.noop,

0 comments on commit d2e603d

Please sign in to comment.