Skip to main content

Search and Top Navigation

#10724 closed bug (notabug)

Opened December 12, 2014 09:08PM UTC

Closed December 12, 2014 09:13PM UTC

Last modified December 12, 2014 09:15PM UTC

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.

Attachments (0)
Change History (2)

Changed December 12, 2014 09:13PM UTC by scottgonzalez comment:1

resolution: → notabug
status: newclosed

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

Changed December 12, 2014 09:15PM UTC by scottgonzalez comment:2

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.