From 285960078942e598869e170510001c871753675b Mon Sep 17 00:00:00 2001 From: Ris Adams Date: Thu, 3 Nov 2022 19:39:05 -0400 Subject: [PATCH] Fix #1893 --- src/selectize.jquery.js | 321 ++++++++++++++++++++-------------------- 1 file changed, 161 insertions(+), 160 deletions(-) diff --git a/src/selectize.jquery.js b/src/selectize.jquery.js index d8034d43c..7d7ffc939 100644 --- a/src/selectize.jquery.js +++ b/src/selectize.jquery.js @@ -1,61 +1,61 @@ -$.fn.selectize = function(settings_user) { - var defaults = $.fn.selectize.defaults; - var settings = $.extend({}, defaults, settings_user); - var attr_data = settings.dataAttr; - var field_label = settings.labelField; - var field_value = settings.valueField; - var field_disabled = settings.disabledField; - var field_optgroup = settings.optgroupField; - var field_optgroup_label = settings.optgroupLabelField; - var field_optgroup_value = settings.optgroupValueField; - - /** - * Initializes selectize from a element. - * - * @param {JQuery} $input - * @param {Object} settings_element - */ - var init_textbox = function($input, settings_element) { - var i, n, values, option; - - var data_raw = $input.attr(attr_data); - - if (!data_raw) { - var value = ($input.val() || '').trim(); - if (!settings.allowEmptyOption && !value.length) return; - values = value.split(settings.delimiter); - for (i = 0, n = values.length; i < n; i++) { - option = {}; - option[field_label] = values[i]; - option[field_value] = values[i]; - settings_element.options.push(option); - } - settings_element.items = values; - } else { - settings_element.options = JSON.parse(data_raw); - for (i = 0, n = settings_element.options.length; i < n; i++) { - settings_element.items.push(settings_element.options[i][field_value]); - } - } - }; - - /** - * Initializes selectize from a element. + * + * @param {JQuery} $input + * @param {Object} settings_element + */ + var init_textbox = function ($input, settings_element) { + var i, n, values, option; + + var data_raw = $input.attr(attr_data); + + if (!data_raw) { + var value = ($input.val() || '').trim(); + if (!settings.allowEmptyOption && !value.length) return; + values = value.split(settings.delimiter); + for (i = 0, n = values.length; i < n; i++) { + option = {}; + option[field_label] = values[i]; + option[field_value] = values[i]; + settings_element.options.push(option); + } + settings_element.items = values; + } else { + settings_element.options = JSON.parse(data_raw); + for (i = 0, n = settings_element.options.length; i < n; i++) { + settings_element.items.push(settings_element.options[i][field_value]); + } + } + }; + + /** + * Initializes selectize from a