Skip to content

Commit eca62f9

Browse files
committed
noUiSlider 14.6.3
1 parent 7acb840 commit eca62f9

File tree

6 files changed

+33
-13
lines changed

6 files changed

+33
-13
lines changed

CHANGELOG.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
### 14.6.3 (*2020-11-19*)
4+
- Fixed: Fixed removing namespaced event listeners, internal listeners getting removed (#1109);
5+
36
### 14.6.2 (*2020-09-16*)
47
- Fixed: Ignore erroneous mouse events on taps for iOS 13.4 (#1095);
58
- Added: `exactInput` argument to `set` and `setHandle` methods (#436, #1094);

distribute/nouislider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! nouislider - 14.6.2 - 9/16/2020 */
1+
/*! nouislider - 14.6.3 - 11/19/2020 */
22
/* Functional styling;
33
* These styles are required for noUiSlider to function.
44
* You don't need to change these rules to apply your design.

distribute/nouislider.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! nouislider - 14.6.2 - 9/16/2020 */
1+
/*! nouislider - 14.6.3 - 11/19/2020 */
22
(function(factory) {
33
if (typeof define === "function" && define.amd) {
44
// AMD. Register as an anonymous module.
@@ -13,7 +13,7 @@
1313
})(function() {
1414
"use strict";
1515

16-
var VERSION = "14.6.2";
16+
var VERSION = "14.6.3";
1717

1818
//region Helper Methods
1919

@@ -633,6 +633,12 @@
633633
valueSub: "value-sub"
634634
};
635635

636+
// Namespaces of internal event listeners
637+
var INTERNAL_EVENT_NS = {
638+
tooltips: ".__tooltips",
639+
aria: ".__aria"
640+
};
641+
636642
//endregion
637643

638644
function validateFormat(entry) {
@@ -1243,7 +1249,7 @@
12431249

12441250
function removeTooltips() {
12451251
if (scope_Tooltips) {
1246-
removeEvent("update.tooltips");
1252+
removeEvent("update" + INTERNAL_EVENT_NS.tooltips);
12471253
scope_Tooltips.forEach(function(tooltip) {
12481254
if (tooltip) {
12491255
removeElement(tooltip);
@@ -1260,7 +1266,7 @@
12601266
// Tooltips are added with options.tooltips in original order.
12611267
scope_Tooltips = scope_Handles.map(addTooltip);
12621268

1263-
bindEvent("update.tooltips", function(values, handleNumber, unencoded) {
1269+
bindEvent("update" + INTERNAL_EVENT_NS.tooltips, function(values, handleNumber, unencoded) {
12641270
if (!scope_Tooltips[handleNumber]) {
12651271
return;
12661272
}
@@ -1276,7 +1282,8 @@
12761282
}
12771283

12781284
function aria() {
1279-
bindEvent("update", function(values, handleNumber, unencoded, tap, positions) {
1285+
removeEvent("update" + INTERNAL_EVENT_NS.aria);
1286+
bindEvent("update" + INTERNAL_EVENT_NS.aria, function(values, handleNumber, unencoded, tap, positions) {
12801287
// Update Aria Values for all handles, as a change in one changes min and max values for the next.
12811288
scope_HandleNumbers.forEach(function(index) {
12821289
var handle = scope_Handles[index];
@@ -2092,17 +2099,23 @@
20922099
}
20932100
}
20942101

2102+
function isInternalNamespace(namespace) {
2103+
return namespace === INTERNAL_EVENT_NS.aria || namespace === INTERNAL_EVENT_NS.tooltips;
2104+
}
2105+
20952106
// Undo attachment of event
20962107
function removeEvent(namespacedEvent) {
20972108
var event = namespacedEvent && namespacedEvent.split(".")[0];
2098-
var namespace = event && namespacedEvent.substring(event.length);
2109+
var namespace = event ? namespacedEvent.substring(event.length) : namespacedEvent;
20992110

21002111
Object.keys(scope_Events).forEach(function(bind) {
21012112
var tEvent = bind.split(".")[0];
21022113
var tNamespace = bind.substring(tEvent.length);
2103-
21042114
if ((!event || event === tEvent) && (!namespace || namespace === tNamespace)) {
2105-
delete scope_Events[bind];
2115+
// only delete protected internal event if intentional
2116+
if (!isInternalNamespace(tNamespace) || namespace === tNamespace) {
2117+
delete scope_Events[bind];
2118+
}
21062119
}
21072120
});
21082121
}
@@ -2446,6 +2459,10 @@
24462459

24472460
// Removes classes from the root and empties it.
24482461
function destroy() {
2462+
// remove protected internal listeners
2463+
removeEvent(INTERNAL_EVENT_NS.aria);
2464+
removeEvent(INTERNAL_EVENT_NS.tooltips);
2465+
24492466
for (var key in options.cssClasses) {
24502467
if (!options.cssClasses.hasOwnProperty(key)) {
24512468
continue;

distribute/nouislider.min.css

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

distribute/nouislider.min.js

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nouislider",
3-
"version": "14.6.2",
3+
"version": "14.6.3",
44
"main": "distribute/nouislider.js",
55
"style": "distribute/nouislider.min.css",
66
"license": "MIT",

0 commit comments

Comments
 (0)