Browse Source

Unselected item is returned as options only if event isn't prevented

Ján Koščo 11 years ago
parent
commit
2059b5d4d3
1 changed files with 6 additions and 6 deletions
  1. 6 6
      select2.js

+ 6 - 6
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 });