Fix selectize event namespacing issues (#3919)

Co-authored-by: cpsievert <cpsievert@users.noreply.github.com>
This commit is contained in:
Carson Sievert
2023-10-20 10:21:29 -05:00
committed by GitHub
parent 7069064dd6
commit ce78d0dcf1
4 changed files with 39 additions and 34 deletions

View File

@@ -834,6 +834,9 @@ var Selectize = function($input, settings) {
self.settings = {};
// increase the count of 'active' (i.e., non-destroyed) selectize instances
++Selectize.count;
$.extend(self, {
order : 0,
settings : settings,
@@ -841,8 +844,8 @@ var Selectize = function($input, settings) {
tabIndex : $input.attr('tabindex') || '',
tagType : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
rtl : /rtl/i.test(dir),
eventNS : '.selectize' + (++Selectize.count),
// generate a unique ID for the event namespace
eventNS : '.selectize-' + (new Date().getTime()) + '-' + (Math.random().toString(36).substr(2, 5)),
highlightedValue : null,
isBlurring : false,
isOpen : false,

File diff suppressed because one or more lines are too long

View File

@@ -55,6 +55,14 @@ build({
minify: true,
});
build({
...opts,
entryPoints: [outDir + "selectize/js/selectize.js"],
outfile: outDir + "selectize/js/selectize.min.js",
minify: true,
target: "es6",
});
build({
...opts,
entryPoints: [outDir + "selectize/accessibility/js/selectize-plugin-a11y.js"],

View File

@@ -0,0 +1,25 @@
diff --git a/inst/www/shared/selectize/js/selectize.js b/inst/www/shared/selectize/js/selectize.js
index 0b447a7b3..cbfe9178e 100644
--- a/inst/www/shared/selectize/js/selectize.js
+++ b/inst/www/shared/selectize/js/selectize.js
@@ -834,6 +834,9 @@ var Selectize = function($input, settings) {
self.settings = {};
+ // increase the count of 'active' (i.e., non-destroyed) selectize instances
+ ++Selectize.count;
+
$.extend(self, {
order : 0,
settings : settings,
@@ -841,8 +844,8 @@ var Selectize = function($input, settings) {
tabIndex : $input.attr('tabindex') || '',
tagType : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
rtl : /rtl/i.test(dir),
-
- eventNS : '.selectize' + (++Selectize.count),
+ // generate a unique ID for the event namespace
+ eventNS : '.selectize-' + (new Date().getTime()) + '-' + (Math.random().toString(36).substr(2, 5)),
highlightedValue : null,
isBlurring : false,
isOpen : false,