Skip to content

Commit 2059b5d

Browse files
committed
Unselected item is returned as options only if event isn't prevented
1 parent ec97c81 commit 2059b5d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

select2.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,12 +2988,6 @@ the specific language governing permissions and limitations under the Apache Lic
29882988
return;
29892989
}
29902990

2991-
while((index = indexOf(this.id(data), val)) >= 0) {
2992-
val.splice(index, 1);
2993-
this.setVal(val);
2994-
if (this.select) this.postprocessResults();
2995-
}
2996-
29972991
var evt = $.Event("select2-removing");
29982992
evt.val = this.id(data);
29992993
evt.choice = data;
@@ -3003,6 +2997,12 @@ the specific language governing permissions and limitations under the Apache Lic
30032997
return;
30042998
}
30052999

3000+
while((index = indexOf(this.id(data), val)) >= 0) {
3001+
val.splice(index, 1);
3002+
this.setVal(val);
3003+
if (this.select) this.postprocessResults();
3004+
}
3005+
30063006
selected.remove();
30073007

30083008
this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });

0 commit comments

Comments
 (0)