瀏覽代碼

Fixed TypeError when destroying Select2

This fixes #2587.
Kevin Brown 10 年之前
父節點
當前提交
1de4be3749
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      select2.js

+ 8 - 2
select2.js

@@ -2214,11 +2214,17 @@ the specific language governing permissions and limitations under the Apache Lic
             }));
 
             selection.on("mousedown touchstart", "abbr", this.bind(function (e) {
-                if (!this.isInterfaceEnabled()) return;
+                if (!this.isInterfaceEnabled()) {
+                    return;
+                }
+
                 this.clear();
                 killEventImmediately(e);
                 this.close();
-                this.selection.focus();
+
+                if (this.selection) {
+                    this.selection.focus();
+                }
             }));
 
             selection.on("mousedown touchstart", this.bind(function (e) {