From 2059b5d4d3c2b23229a2f2f7d9b4a6b353c0fa80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Wed, 5 Mar 2014 10:55:42 +0100 Subject: [PATCH] Unselected item is returned as options only if event isn't prevented --- select2.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/select2.js b/select2.js index ec8af72c..11e30516 100644 --- a/select2.js +++ b/select2.js @@ -2988,12 +2988,6 @@ the specific language governing permissions and limitations under the Apache Lic return; } - while((index = indexOf(this.id(data), val)) >= 0) { - val.splice(index, 1); - this.setVal(val); - if (this.select) this.postprocessResults(); - } - var evt = $.Event("select2-removing"); evt.val = this.id(data); evt.choice = data; @@ -3003,6 +2997,12 @@ the specific language governing permissions and limitations under the Apache Lic return; } + while((index = indexOf(this.id(data), val)) >= 0) { + val.splice(index, 1); + this.setVal(val); + if (this.select) this.postprocessResults(); + } + selected.remove(); this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });