Bläddra i källkod

Fixed TypeError when destroying Select2

This fixes #2587.
Kevin Brown 10 år sedan
förälder
incheckning
1de4be3749
1 ändrade filer med 8 tillägg och 2 borttagningar
  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) {