Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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 Scott González

Resolution: notabug
Status: newclosed

There is never a reason for a widget to override destroy(), so there is no bug.

comment:2 in reply to:  description Changed 8 years ago by Scott González

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.

Note: See TracTickets for help on using tickets.