#1836 closed defect (fixed)
Menu: not fully destroyed (target nodes still bound)
Reported by: | guest | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | Dijit | Version: | 0.4 |
Keywords: | Menu2 PopupMenu2 | Cc: | |
Blocked By: | Blocking: |
Description
PopupMenu2 initializers bind to the target nodes, but that is currently not undone when destroying the widget (this breaks any future menu functionality on those nodes).
The passive workaround is to unbind the target nodes before destroying:
var menu = dojo.widget.byId('mymenu'); dojo.lang.forEach(menu.targetNodeIds, menu.unBindDomNode, menu); menu.destroy();
I'm not sure what the proper override is in Menu2.js (Widget::cleanUp, Widget::uninitialize, Widget::destroyRendering ?), but a patch might look like this:
uninitialize: function(){ dojo.lang.forEach(this.targetNodeIds, this.unBindDomNode, this); }
Change History (5)
comment:1 Changed 16 years ago by
Milestone: | → 0.5 |
---|---|
Owner: | changed from bill to liucougar |
comment:2 Changed 15 years ago by
Component: | Widgets → Dijit |
---|---|
Milestone: | 0.9 → 1.0 |
Owner: | changed from liucougar to bill |
Summary: | PopupMenu2.destroy() -- not fully destroyed (target nodes still bound) → Menu: not fully destroyed (target nodes still bound) |
Hmm, I guess this is still an issue with the Dijit Menu.
comment:3 Changed 15 years ago by
Milestone: | 1.0 → 1.1 |
---|
comment:4 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Yes, we need to cleanup the bindings to all nodes in this.targetNodeIds[], as well as any nodes that were bound to manual calls to bindDomNode(), and also just the binding to document.body itself (for window-level context menu).
I wish there were a way to delete all events that connect to a certain function.