Where to put the default destroy in the jQuery UI 1.8.1 widget's destroy function -
ok, i'm having slight bit of confusion writing own jquery ui widget plugins. problem lies in destroy function. in docs, says put default destroy first write other things particular widget after it.
$.widget.prototype.destroy.apply(this, arguments); // default destroy // other stuff particular widget
see http://jqueryui.com/docs/developer_guide
however in example scripts (those being actual pluings jquery ui released code, opposite.
$.widget.prototype.destroy.apply(this, arguments);
is @ end of function. see http://dev.jqueryui.com/browser/trunk/ui/jquery.ui.progressbar.js (and of other built in widgets well)
so it? way current widgets written, or explanation in code comment in developer_guide?
i put @ end, in case crazy happens, make sure you've created gets destroyed, let base methods work. practical standpoint?
it doesn't matter
it's matter of taste, , in 2 examples linked, taste of developers writing them differed (or changed on time)...not big enough issue documentation consistent.
disclaimer: opinion here!
in cases this, think it's safer stay convention of code instead of documentation. you're actively running code in browser, it's passing jquery unit tests, it's what's running...not documentation may or may not accurate or outdated. know i'm guilty of this, , i'm not alone...i don't update documentation often, not near refactor/improve code @ least :)
Comments
Post a Comment