Opened 13 years ago

Closed 13 years ago

#5005 closed bug (fixed)

Widget factory does not clean up event bindings

Reported by: Scott González Owned by: Scott González
Priority: blocker Milestone: 1.8
Component: ui.core Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

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

Change History (4)

comment:1 Changed 13 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 13 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 13 years ago by Scott González

Owner: set to scott.gonzalez
Status: newaccepted

Fixed in new widget factory in dev branch in r3544.

comment:4 Changed 13 years ago by Scott González

Resolution: fixed
Status: acceptedclosed

Fixed in trunk in r3621 with merge.

Note: See TracTickets for help on using tickets.