
defaultOptions need to be cloned
Reported by Guillaume Poirier | August 2nd, 2008 @ 03:33 PM | in 1.0
In the window.js file, there's a few classes that have a defaultOptions static field. This field is used inappropriately, for example:
Control.Modal = Class.create(Control.Window,{
initialize: function($super,container,options){
Control.Modal.InstanceMethods.beforeInitialize.bind(this)();
$super(container,Object.extend(Control.Modal.defaultOptions,options || {}));
}
});
The method extend will mutate the first argument, which is a shared static field. The defaultOptions need to be cloned before they can be extended:
Control.Modal = Class.create(Control.Window,{
initialize: function($super,container,options){
Control.Modal.InstanceMethods.beforeInitialize.bind(this)();
$super(container,Object.extend(Object.clone(Control.Modal.defaultOptions),options || {}));
}
});
Comments and changes to this ticket
-
Guillaume Poirier August 2nd, 2008 @ 03:36 PM
I've attached an example of the problem it creates. The example has two Modal windows with different options. The options from the first Control.Modal are used as default options for the second Control.Modal.
-
Ryan Johnson September 9th, 2008 @ 12:11 PM
- State changed from unconfirmed to resolved
Good catch! I've added the clone call to all of the relevant places in the latest version.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
NOTE: Please do not open tickets here. If you have an issue, please open it on http://github.com/syntacticx/livepipe-ui/issues/
High quality widgets and controls for web 2.0 applications built using the Prototype JavaScript Framework. Each control is well tested, highly extensible, fully documented and degrades gracefully for non JavaScript enabled browsers where possible. MIT licensed and actively maintained.