From 44bd07f03801290973fc428dd53f00aa4cd75c7f Mon Sep 17 00:00:00 2001 From: Pl217 Date: Thu, 24 May 2018 23:14:59 +0200 Subject: [PATCH] Fix onInputChange being called twice ULS input element had onInputChange() handler attached to change, textInput and input events. That caused onInputChange() to be called twice when there is user input and ULS gets closed, since 'change' event fires when element loses focus. Registering handler only for 'input' is sufficient for the intent. --- src/jquery.uls.languagefilter.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/jquery.uls.languagefilter.js b/src/jquery.uls.languagefilter.js index 7212b11..4262efd 100644 --- a/src/jquery.uls.languagefilter.js +++ b/src/jquery.uls.languagefilter.js @@ -59,10 +59,7 @@ listen: function () { this.$element.on( 'keydown', this.keypress.bind( this ) ); - this.$element.on( - 'change textInput input', - $.fn.uls.debounce( this.onInputChange.bind( this ), 300 ) - ); + this.$element.on( 'input', $.fn.uls.debounce( this.onInputChange.bind( this ), 300 ) ); if ( this.$clear.length ) { this.$clear.on( 'click', this.clear.bind( this ) );