Skip to content

Commit 1de4be3

Browse files
committed
Fixed TypeError when destroying Select2
This fixes select2#2587.
1 parent 7581fa5 commit 1de4be3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

select2.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,11 +2214,17 @@ the specific language governing permissions and limitations under the Apache Lic
22142214
}));
22152215

22162216
selection.on("mousedown touchstart", "abbr", this.bind(function (e) {
2217-
if (!this.isInterfaceEnabled()) return;
2217+
if (!this.isInterfaceEnabled()) {
2218+
return;
2219+
}
2220+
22182221
this.clear();
22192222
killEventImmediately(e);
22202223
this.close();
2221-
this.selection.focus();
2224+
2225+
if (this.selection) {
2226+
this.selection.focus();
2227+
}
22222228
}));
22232229

22242230
selection.on("mousedown touchstart", this.bind(function (e) {

0 commit comments

Comments
 (0)