1
0
mirror of synced 2025-02-09 16:49:24 +03:00

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:
Kevin Brown 2016-03-27 14:59:44 -04:00
parent 8869b170b1
commit c2c1aeef31

View File

@ -22,6 +22,7 @@ define([
return this;
} else if (typeof options === 'string') {
var ret;
var args = Array.prototype.slice.call(arguments, 1);
this.each(function () {
var instance = $(this).data('select2');
@ -33,8 +34,6 @@ define([
);
}
var args = Array.prototype.slice.call(arguments, 1);
ret = instance[options].apply(instance, args);
});