소스 검색

dont error out when 'x' is removed really fast multiple times. fixes #745

Igor Vaynberg 12 년 전
부모
커밋
3f14f773f9
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      select2.js

+ 6 - 0
select2.js

@@ -2169,6 +2169,12 @@ the specific language governing permissions and limitations under the Apache Lic
 
             data = selected.data("select2-data");
 
+            if (!data) {
+                // prevent a race condition when the 'x' is clicked really fast repeatedly the event can be queued
+                // and invoked on an element already removed
+                return;
+            }
+
             index = indexOf(this.id(data), val);
 
             if (index >= 0) {