From 2b66d52400625d65f4caf61fcf1b66b1469c0d86 Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine Date: Sat, 5 Feb 2022 13:00:20 +0100 Subject: [PATCH 1/2] Only copy type from $input to $control_input if $input actually is an input. If $input is not actually an but e.g. a select then blindly copying $input.type results in an undefined or strange type property for the $control_input. --- src/selectize.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/selectize.js b/src/selectize.js index 64b8f8670..2bddb395e 100644 --- a/src/selectize.js +++ b/src/selectize.js @@ -180,7 +180,9 @@ $.extend(Selectize.prototype, { if ($input.attr('autocapitalize')) { $control_input.attr('autocapitalize', $input.attr('autocapitalize')); } - $control_input[0].type = $input[0].type; + if ($input.is('input')) { + $control_input[0].type = $input[0].type; + } self.$wrapper = $wrapper; self.$control = $control; From dc20b91c65df3de8084fb7b154c93c3c6e00e068 Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine Date: Thu, 9 Sep 2021 00:58:49 +0200 Subject: [PATCH 2/2] setValue: only fire an event if really something has changed. --- src/selectize.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/selectize.js b/src/selectize.js index 2bddb395e..fb05f7dcc 100644 --- a/src/selectize.js +++ b/src/selectize.js @@ -817,6 +817,11 @@ $.extend(Selectize.prototype, { * @param {mixed} value */ setValue: function(value, silent) { + const items = Array.isArray(value) ? value : [value]; + if (items.join('') === this.items.join('')) { + return; + } + var events = silent ? [] : ['change']; debounce_events(this, events, function() {