Fix calling select2('', args) on multiple elements
This fixes an issue that has existed since Select2 4.0.1 where the arguments passed into each `<select>` were mutated. This no longer mutates the arguments for each element, and instead only drops the first argument once. This closes https://github.com/select2/select2/issues/4245
This commit is contained in:
parent
8869b170b1
commit
c2c1aeef31
@ -22,6 +22,7 @@ define([
|
|||||||
return this;
|
return this;
|
||||||
} else if (typeof options === 'string') {
|
} else if (typeof options === 'string') {
|
||||||
var ret;
|
var ret;
|
||||||
|
var args = Array.prototype.slice.call(arguments, 1);
|
||||||
|
|
||||||
this.each(function () {
|
this.each(function () {
|
||||||
var instance = $(this).data('select2');
|
var instance = $(this).data('select2');
|
||||||
@ -33,8 +34,6 @@ define([
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = Array.prototype.slice.call(arguments, 1);
|
|
||||||
|
|
||||||
ret = instance[options].apply(instance, args);
|
ret = instance[options].apply(instance, args);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user