Skip to content

Commit 97e44cd

Browse files
PxlBuzzardscottgonzalez
authored andcommitted
Stateful Plugins: Update widget factory for jQuery UI 1.9+
Closes gh-639
1 parent b5da8f9 commit 97e44cd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

page/plugins/stateful-plugins-with-widget-factory.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ $.nmk.progressbar.prototype.reset = function() {
257257

258258
### Cleaning Up
259259

260-
In some cases, it will make sense to allow users to apply and then later unapply your plugin. You can accomplish this via the `destroy` method. Within the `destroy` method, you should undo anything your plugin may have done during initialization or later use. The `destroy` method is automatically called if the element that your plugin instance is tied to is removed from the DOM, so this can be used for garbage collection as well. The default `destroy` method removes the link between the DOM element and the plugin instance, so it's important to call the base function from your plugin's `destroy` method.
260+
In some cases, it will make sense to allow users to apply and then later unapply your plugin. You can accomplish this via the `_destroy` method. Within the `_destroy` method, you should undo anything your plugin may have done during initialization or later use. The `_destroy` method is automatically called if the element that your plugin instance is tied to is removed from the DOM, so this can be used for garbage collection as well. The base `destroy` method calls `_destroy` on the plugin instance.
261261

262262
Adding a destroy method to a widget:
263263

@@ -286,13 +286,10 @@ $.widget( "nmk.progressbar", {
286286
}
287287
},
288288
289-
destroy: function() {
289+
_destroy: function() {
290290
this.element
291291
.removeClass( "progressbar" )
292292
.text( "" );
293-
294-
// Call the base destroy function.
295-
$.Widget.prototype.destroy.call( this );
296293
}
297294
298295
});

0 commit comments

Comments
 (0)