|
1 | | -/*! nouislider - 14.6.2 - 9/16/2020 */ |
| 1 | +/*! nouislider - 14.6.3 - 11/19/2020 */ |
2 | 2 | (function(factory) { |
3 | 3 | if (typeof define === "function" && define.amd) { |
4 | 4 | // AMD. Register as an anonymous module. |
|
13 | 13 | })(function() { |
14 | 14 | "use strict"; |
15 | 15 |
|
16 | | - var VERSION = "14.6.2"; |
| 16 | + var VERSION = "14.6.3"; |
17 | 17 |
|
18 | 18 | //region Helper Methods |
19 | 19 |
|
|
633 | 633 | valueSub: "value-sub" |
634 | 634 | }; |
635 | 635 |
|
| 636 | + // Namespaces of internal event listeners |
| 637 | + var INTERNAL_EVENT_NS = { |
| 638 | + tooltips: ".__tooltips", |
| 639 | + aria: ".__aria" |
| 640 | + }; |
| 641 | + |
636 | 642 | //endregion |
637 | 643 |
|
638 | 644 | function validateFormat(entry) { |
|
1243 | 1249 |
|
1244 | 1250 | function removeTooltips() { |
1245 | 1251 | if (scope_Tooltips) { |
1246 | | - removeEvent("update.tooltips"); |
| 1252 | + removeEvent("update" + INTERNAL_EVENT_NS.tooltips); |
1247 | 1253 | scope_Tooltips.forEach(function(tooltip) { |
1248 | 1254 | if (tooltip) { |
1249 | 1255 | removeElement(tooltip); |
|
1260 | 1266 | // Tooltips are added with options.tooltips in original order. |
1261 | 1267 | scope_Tooltips = scope_Handles.map(addTooltip); |
1262 | 1268 |
|
1263 | | - bindEvent("update.tooltips", function(values, handleNumber, unencoded) { |
| 1269 | + bindEvent("update" + INTERNAL_EVENT_NS.tooltips, function(values, handleNumber, unencoded) { |
1264 | 1270 | if (!scope_Tooltips[handleNumber]) { |
1265 | 1271 | return; |
1266 | 1272 | } |
|
1276 | 1282 | } |
1277 | 1283 |
|
1278 | 1284 | 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) { |
1280 | 1287 | // Update Aria Values for all handles, as a change in one changes min and max values for the next. |
1281 | 1288 | scope_HandleNumbers.forEach(function(index) { |
1282 | 1289 | var handle = scope_Handles[index]; |
|
2092 | 2099 | } |
2093 | 2100 | } |
2094 | 2101 |
|
| 2102 | + function isInternalNamespace(namespace) { |
| 2103 | + return namespace === INTERNAL_EVENT_NS.aria || namespace === INTERNAL_EVENT_NS.tooltips; |
| 2104 | + } |
| 2105 | + |
2095 | 2106 | // Undo attachment of event |
2096 | 2107 | function removeEvent(namespacedEvent) { |
2097 | 2108 | var event = namespacedEvent && namespacedEvent.split(".")[0]; |
2098 | | - var namespace = event && namespacedEvent.substring(event.length); |
| 2109 | + var namespace = event ? namespacedEvent.substring(event.length) : namespacedEvent; |
2099 | 2110 |
|
2100 | 2111 | Object.keys(scope_Events).forEach(function(bind) { |
2101 | 2112 | var tEvent = bind.split(".")[0]; |
2102 | 2113 | var tNamespace = bind.substring(tEvent.length); |
2103 | | - |
2104 | 2114 | 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 | + } |
2106 | 2119 | } |
2107 | 2120 | }); |
2108 | 2121 | } |
|
2446 | 2459 |
|
2447 | 2460 | // Removes classes from the root and empties it. |
2448 | 2461 | function destroy() { |
| 2462 | + // remove protected internal listeners |
| 2463 | + removeEvent(INTERNAL_EVENT_NS.aria); |
| 2464 | + removeEvent(INTERNAL_EVENT_NS.tooltips); |
| 2465 | + |
2449 | 2466 | for (var key in options.cssClasses) { |
2450 | 2467 | if (!options.cssClasses.hasOwnProperty(key)) { |
2451 | 2468 | continue; |
|
0 commit comments