| Issue 141: | Having more than one tree on a page can lead to options conflicts during instantiation | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem?
1. Create two or more dynatrees on a page with differing options (in 0.5.3)
2. Examine the options being set in _create
What is the expected output? What do you see instead?
Each tree should have a fresh, unique set of options combining the defaults
and the user supplied options
What version of the product are you using?
0.5.3
On what operating system and browser?
FF 3.6/Mac
Please provide any additional information below.
The new logic in _create is accidentally merging the user supplied options
during instantiations (this.options) into the baseline defaults in
$.ui.dynatree.defaults, so later invocations of trees will now use a
modified version of the global defaults, causing unexpected results.
See _create:
_create: function() {
if( parseFloat($.ui.version) >= 1.8 ) {
this.options = $.extend(true,
$[this.namespace][this.widgetName].defaults, this.options);
}
should probably be
_create: function() {
if( parseFloat($.ui.version) >= 1.8 ) {
this.options = $.extend(true, {},
$[this.namespace][this.widgetName].defaults, this.options);
}
as the deep copy version of .extend will use the second parameter as the
target. In the shipping 0.5.3, this will aggregate user supplied values
into the defaults. The proposed second version creates a fresh copy
combining the defaults with the user supplied options, and returning those
into the per-instance copy of the options.
May 4, 2010
thanks
Status:
Fixed
Jul 17, 2012
considered verified
Status:
Verified
|
Owner: moo...@wwWendt.de
Labels: Milestone-Release0.5.4