Fixed deep cloning options
In
f1e86470ca
we tried to fix the issue where multiple instances created in a single
call would share the same options, and this worked for the most common
cases. Unfortunately it did not work for the case where data attributes
were also used with an options object, and as a result data attributes
would be copied to all instances. Data attributes are supposed to be
specific to a single instance.
This was fixed by moving the `true` for the deep copy to the start of
the `$.extend` call, as this is where jQuery looks for the deep copy
flag.
This closes https://github.com/select2/select2/issues/3485
This commit is contained in:
parent
e2b745ea3e
commit
3c8366e876
@ -17,7 +17,7 @@ define([
|
||||
|
||||
if (typeof options === 'object') {
|
||||
this.each(function () {
|
||||
var instanceOptions = $.extend({}, options, true);
|
||||
var instanceOptions = $.extend(true, {}, options);
|
||||
|
||||
var instance = new Select2($(this), instanceOptions);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user