On Wed, Feb 18, 2009 at 4:47 PM, crungmun...@googlemail.com <crungmun...@googlemail.com> wrote: > > Hi, > > However, I would like to add some extra > functionality to the plugin which is specific to my application. In > this circumstance is it better to write the functionality into the > plugin directly or 'extend' it somehow?
I ran into this myself a couple of times. The jQuery framework leaves much to be desired in this arena and there is considerable lack of proper OO inheritance from what I am aware of (I have only been on jQuery for 2-3 weeks). I recently tried to extend the ui.spinner var mspinner = $.extend({}, $.ui.spinner.prototype, { _init: function(){ $.ui.spinner.prototype._init.call(this); } }); $.widget("ui.mspinner", mspinner); But _init is private so that didn't work. I ran into some other errors such as options.items not defined for reasons I didn't care to explore. It's not possible to override functions and there were a range of other issues that I ran into that I just decided to drop the idea. If someone knows of a better way or tried and tested design pattern, I too would be interested. -- Aleem