Skip to content

Commit ce78d0d

Browse files
authored
Fix selectize event namespacing issues (#3919)
Co-authored-by: cpsievert <[email protected]>
1 parent 7069064 commit ce78d0d

File tree

4 files changed

+39
-34
lines changed

4 files changed

+39
-34
lines changed

inst/www/shared/selectize/js/selectize.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,15 +834,18 @@ var Selectize = function($input, settings) {
834834

835835
self.settings = {};
836836

837+
// increase the count of 'active' (i.e., non-destroyed) selectize instances
838+
++Selectize.count;
839+
837840
$.extend(self, {
838841
order : 0,
839842
settings : settings,
840843
$input : $input,
841844
tabIndex : $input.attr('tabindex') || '',
842845
tagType : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
843846
rtl : /rtl/i.test(dir),
844-
845-
eventNS : '.selectize' + (++Selectize.count),
847+
// generate a unique ID for the event namespace
848+
eventNS : '.selectize-' + (new Date().getTime()) + '-' + (Math.random().toString(36).substr(2, 5)),
846849
highlightedValue : null,
847850
isBlurring : false,
848851
isOpen : false,

inst/www/shared/selectize/js/selectize.min.js

Lines changed: 1 addition & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

srcts/build/external_libs.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ build({
5555
minify: true,
5656
});
5757

58+
build({
59+
...opts,
60+
entryPoints: [outDir + "selectize/js/selectize.js"],
61+
outfile: outDir + "selectize/js/selectize.min.js",
62+
minify: true,
63+
target: "es6",
64+
});
65+
5866
build({
5967
...opts,
6068
entryPoints: [outDir + "selectize/accessibility/js/selectize-plugin-a11y.js"],
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/inst/www/shared/selectize/js/selectize.js b/inst/www/shared/selectize/js/selectize.js
2+
index 0b447a7b3..cbfe9178e 100644
3+
--- a/inst/www/shared/selectize/js/selectize.js
4+
+++ b/inst/www/shared/selectize/js/selectize.js
5+
@@ -834,6 +834,9 @@ var Selectize = function($input, settings) {
6+
7+
self.settings = {};
8+
9+
+ // increase the count of 'active' (i.e., non-destroyed) selectize instances
10+
+ ++Selectize.count;
11+
+
12+
$.extend(self, {
13+
order : 0,
14+
settings : settings,
15+
@@ -841,8 +844,8 @@ var Selectize = function($input, settings) {
16+
tabIndex : $input.attr('tabindex') || '',
17+
tagType : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
18+
rtl : /rtl/i.test(dir),
19+
-
20+
- eventNS : '.selectize' + (++Selectize.count),
21+
+ // generate a unique ID for the event namespace
22+
+ eventNS : '.selectize-' + (new Date().getTime()) + '-' + (Math.random().toString(36).substr(2, 5)),
23+
highlightedValue : null,
24+
isBlurring : false,
25+
isOpen : false,

0 commit comments

Comments
 (0)