From 8a5aeabcceccfeb703b4ac58c313de8225a400db Mon Sep 17 00:00:00 2001 From: kevin-j-morse <4412177+kevin-j-morse@users.noreply.github.com> Date: Sat, 20 Jul 2019 13:05:48 -0700 Subject: [PATCH] Remove deprecated jQuery shorthand (#5564) --- src/js/select2/data/tokenizer.js | 2 +- src/js/select2/dropdown/search.js | 8 ++++---- src/js/select2/selection/base.js | 2 +- src/js/select2/selection/search.js | 2 +- src/js/select2/selection/single.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/js/select2/data/tokenizer.js b/src/js/select2/data/tokenizer.js index 77576556..7bfa575d 100644 --- a/src/js/select2/data/tokenizer.js +++ b/src/js/select2/data/tokenizer.js @@ -58,7 +58,7 @@ define([ // Replace the search term if we have the search box if (this.$search.length) { this.$search.val(tokenData.term); - this.$search.focus(); + this.$search.trigger('focus'); } params.term = tokenData.term; diff --git a/src/js/select2/dropdown/search.js b/src/js/select2/dropdown/search.js index 026fb543..78693892 100644 --- a/src/js/select2/dropdown/search.js +++ b/src/js/select2/dropdown/search.js @@ -49,10 +49,10 @@ define([ container.on('open', function () { self.$search.attr('tabindex', 0); - self.$search.focus(); + self.$search.trigger('focus'); window.setTimeout(function () { - self.$search.focus(); + self.$search.trigger('focus'); }, 0); }); @@ -60,12 +60,12 @@ define([ self.$search.attr('tabindex', -1); self.$search.val(''); - self.$search.blur(); + self.$search.trigger('blur'); }); container.on('focus', function () { if (!container.isOpen()) { - self.$search.focus(); + self.$search.trigger('focus'); } }); diff --git a/src/js/select2/selection/base.js b/src/js/select2/selection/base.js index 6d373bd7..27a1acb2 100644 --- a/src/js/select2/selection/base.js +++ b/src/js/select2/selection/base.js @@ -82,7 +82,7 @@ define([ self.$selection.removeAttr('aria-owns'); window.setTimeout(function () { - self.$selection.focus(); + self.$selection.trigger('focus'); }, 0); self._detachCloseHandler(container); diff --git a/src/js/select2/selection/search.js b/src/js/select2/selection/search.js index 9ce321be..353c5621 100644 --- a/src/js/select2/selection/search.js +++ b/src/js/select2/selection/search.js @@ -175,7 +175,7 @@ define([ this.resizeSearch(); if (searchHadFocus) { - this.$search.focus(); + this.$search.trigger('focus'); } }; diff --git a/src/js/select2/selection/single.js b/src/js/select2/selection/single.js index e9e99aa4..f34c3a12 100644 --- a/src/js/select2/selection/single.js +++ b/src/js/select2/selection/single.js @@ -59,7 +59,7 @@ define([ container.on('focus', function (evt) { if (!container.isOpen()) { - self.$selection.focus(); + self.$selection.trigger('focus'); } }); };