Ticket #5005 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

Widget factory does not clean up event bindings

Reported by: scott.gonzalez Owned by: scott.gonzalez
Priority: blocker Milestone: 1.8
Component: ui.core Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

The base widget binds three event handlers, but does not unbind them on destroy. See  jquery-ui-dev thread.

Change History

comment:1 Changed 5 years ago by thetoolman

Thank you Scott for reporting; here is my current workaround:

destroy: function() {

....

$.widget.prototype.destroy.apply(this, arguments); default destroy

see ticket;  http://dev.jqueryui.com/ticket/5005 code fixes <= 1.7.2 ; expect bug will be fixed in 1.7.3 if($.ui.version <= "1.7.2") {

this.element.unbind("setData." + widgetName); this.element.unbind("getData." + widgetName); this.element.unbind("remove." + widgetName); will remove all events sorry, might have other side effects? this.element.unbind("remove");

}

},

comment:2 Changed 5 years ago by thetoolman

The fix should be as easy as adding these lines to the widget destroy method (approx line 300 in ui.core.js):

this.element.unbind("setData." + name); 
this.element.unbind("getData." + name);
this.element.unbind("remove."  + name);

comment:3 Changed 5 years ago by scott.gonzalez

  • Owner set to scott.gonzalez
  • Status changed from new to accepted

Fixed in new widget factory in dev branch in r3544.

comment:4 Changed 5 years ago by scott.gonzalez

  • Status changed from accepted to closed
  • Resolution set to fixed

Fixed in trunk in r3621 with merge.

Note: See TracTickets for help on using tickets.