Skip to content

Commit 3f14f77

Browse files
committed
dont error out when 'x' is removed really fast multiple times. fixes select2#745
1 parent db39cdf commit 3f14f77

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

select2.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,6 +2169,12 @@ the specific language governing permissions and limitations under the Apache Lic
21692169

21702170
data = selected.data("select2-data");
21712171

2172+
if (!data) {
2173+
// prevent a race condition when the 'x' is clicked really fast repeatedly the event can be queued
2174+
// and invoked on an element already removed
2175+
return;
2176+
}
2177+
21722178
index = indexOf(this.id(data), val);
21732179

21742180
if (index >= 0) {

0 commit comments

Comments
 (0)