#10724 closed bug (notabug)
destroy() method should call base class destroy() method
Reported by: | alanouri | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.core | Version: | 1.11.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When destroy() is called on a widget, it should not be left up to the _destroy() implementation to call the base class destroy() method. This should happen automatically. The derived widget's _destroy() method should be called, and then the base class destroy() method should be called. Pseudo-code:
destroy: function() { this._destroy(); this._super(); }
It looks like there already was a ticket opened 5 years ago and then fixed in 1.9.0: http://bugs.jqueryui.com/ticket/5056. The fix for this ticket, though, did not actually fix issue in the title at all.
If there isn't stomach for changing the behavior at this point, then the documentation for _destroy() (http://api.jqueryui.com/jQuery.widget/#method-_destroy) should be updated to indicate that the widget implementer should always call this.super() at the end of their _destroy() implementation.
Change History (2)
comment:1 Changed 8 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 8 years ago by
As for this comment:
If there isn't stomach for changing the behavior at this point, then the documentation for _destroy() (http://api.jqueryui.com/jQuery.widget/#method-_destroy) should be updated to indicate that the widget implementer should always call this.super() at the end of their _destroy() implementation.
There is no logic in the base _destroy()
, so that would be very silly advice.
There is never a reason for a widget to override
destroy()
, so there is no bug.