app/assets/javascripts/select2.js in select2-rails-3.5.1 vs app/assets/javascripts/select2.js in select2-rails-3.5.2
- old
+ new
@@ -1,9 +1,9 @@
/*
Copyright 2012 Igor Vaynberg
-Version: 3.4.4 Timestamp: Thu Oct 24 13:23:11 PDT 2013
+Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
General Public License version 2 (the "GPL License"). You may choose either license to govern your
use of this software only upon the condition that you accept all of the terms of either the Apache
License or the GPL License.
@@ -2441,10 +2441,11 @@
}
return opts;
},
+ // multi
selectChoice: function (choice) {
var selected = this.container.find(".select2-search-choice-focus");
if (selected.length && choice && choice[0] == selected[0]) {
@@ -2857,11 +2858,10 @@
// multi
unselect: function (selected) {
var val = this.getVal(),
data,
index;
-
selected = selected.closest(".select2-search-choice");
if (selected.length === 0) {
throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
}
@@ -2887,10 +2887,12 @@
if (evt.isDefaultPrevented()) {
return;
}
+ selected.remove();
+
this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
this.triggerChange({ removed: data });
},
// multi
@@ -3001,10 +3003,12 @@
// remove intersection from each array
for (var i = 0; i < current.length; i++) {
for (var j = 0; j < old.length; j++) {
if (equal(this.opts.id(current[i]), this.opts.id(old[j]))) {
current.splice(i, 1);
- i--;
+ if(i>0){
+ i--;
+ }
old.splice(j, 1);
j--;
}
}
}