Opened 6 years ago

Closed 6 years ago

#18802 closed defect (duplicate)

dijit/Destroyable::own dies horribly if owning things without a cleanup method

Reported by: primejunta Owned by: bill
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.11.0-rc1
Keywords: Cc:
Blocked By: Blocking:


To reproduce:

  1. Create a widget or other Destroyable, and .own something without a ::remove, ::destroy, or ::destroyRecursive method
  2. Call that widget's ::destroy method

Expected: widget is destroyed, the .own'ed object is ignored Observed: the destroy sequence fails with "TypeError?: handle[destroyMethodName] is not a function."

Note: it kind of makes sense that it works like this, but breaks back-compatibility. I'm running into this issue when setting listeners on a third-party AMD module which has an ::on method which doesn't return an object with a ::remove method. When I set a listener with dojo/on, it gets delegated to the third-party, and I can't ::own the on as usual. So it would be nice if this was fixed; all it would take is changing line 54 in dojo/Destroyable to:

if(typeof handle[destroyMethodName] == "function") handle[destroyMethodName](preserveDom);

Change History (1)

comment:1 Changed 6 years ago by bill

Resolution: duplicate
Status: newclosed

Dup of #18801.

Note: See TracTickets for help on using tickets.