You may want to ask this on the jQuery UI list: http://groups.google.com/group/jquery-ui
- Richard On Tue, Feb 17, 2009 at 2:28 PM, kazooka <abdrew.my...@gmail.com> wrote: > > I noticed that when creating a custom widget, the default options are > NOT deep copied to the options passed in during instantiation. For > example: > > // Create the widget > $.widget('myWidget', { > init: function (){ > /* > At this point, given the defaults and the instantiation > below, > I would expect the this.options to contain... > { > title: 'My Widget', > classes: { > 'header': '.my-widget-header', > 'content': '.my-widget-content', > 'footer': '.custom-widget-footer' > } > } > > Instead, this.options contains (because of no 'deep > copy')... > { > title: 'My Widget', > classes: { > 'footer': '.custom-widget-footer' > } > } > */ > } > } > ); > > > // Set the widget defaults > $.ui.myWidget.defaults = { > title: 'My Widget', > classes: { > 'header': '.my-widget-header', > 'content': '.my-widget-content', > 'footer': '.my-widget-footer' > } > } > > // Widgefy an element on the page with id='my-widget' > var testWidget = $('#my-widget').myWidget({ > classes: { > 'footer': '.custom-widget-footer' > } > }); >