From 0ff6a9083c012715f9055e5880eda1cdf21ed5f3 Mon Sep 17 00:00:00 2001 From: Andrey Andriychuk Date: Wed, 27 Nov 2019 17:22:31 +0300 Subject: [PATCH] Revert "Removing the double event binding registration of "selection:update" within SingleSelection.prototype to prevent multiple calls on the selection event (#4306)" This reverts commit 20429201c84daf4931b639c1cfe4081feadc995a. --- CHANGELOG.md | 2 -- src/js/select2/selection/single.js | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c620e4d44c..05a7b9e33c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,8 +114,6 @@ - User-defined types not normalized properly when passed in as data (#4632) - Perform deep merge for `Defaults.set()` (#4364) - Fix "the results could not be loaded" displaying during AJAX request (#4356) -- Cache objects in `Utils.__cache` instead of using `$.data` (#4346, #5486) -- Removing the double event binding registration of `selection:update` (#4306) #### Accessibility - Improve `.select2-hidden-accessible` (#4908) diff --git a/src/js/select2/selection/single.js b/src/js/select2/selection/single.js index 5db23e9b1f..dcd86f9c23 100644 --- a/src/js/select2/selection/single.js +++ b/src/js/select2/selection/single.js @@ -62,6 +62,10 @@ define([ self.$selection.trigger('focus'); } }); + + container.on('selection:update', function (params) { + self.update(params.data); + }); }; SingleSelection.prototype.clear = function () {