Skip to content

Commit

Permalink
Fix calling select2('', args) on multiple elements
Browse files Browse the repository at this point in the history
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 #4245
  • Loading branch information
kevin-brown committed Mar 27, 2016
1 parent 8869b17 commit c2c1aee
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/js/jquery.select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -33,8 +34,6 @@ define([
);
}

var args = Array.prototype.slice.call(arguments, 1);

ret = instance[options].apply(instance, args);
});

Expand Down

0 comments on commit c2c1aee

Please sign in to comment.