I'm creating custom widgets with 1.6rc6 and 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'
}
}
---------
To me a deep copy makes more sense.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---