Skip to content

Commit

Permalink
noUiSlider 14.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed Nov 19, 2020
1 parent 7acb840 commit eca62f9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### 14.6.3 (*2020-11-19*)
- Fixed: Fixed removing namespaced event listeners, internal listeners getting removed (#1109);

### 14.6.2 (*2020-09-16*)
- Fixed: Ignore erroneous mouse events on taps for iOS 13.4 (#1095);
- Added: `exactInput` argument to `set` and `setHandle` methods (#436, #1094);
Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 14.6.2 - 9/16/2020 */
/*! nouislider - 14.6.3 - 11/19/2020 */
/* Functional styling;
* These styles are required for noUiSlider to function.
* You don't need to change these rules to apply your design.
Expand Down
33 changes: 25 additions & 8 deletions distribute/nouislider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 14.6.2 - 9/16/2020 */
/*! nouislider - 14.6.3 - 11/19/2020 */
(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
Expand All @@ -13,7 +13,7 @@
})(function() {
"use strict";

var VERSION = "14.6.2";
var VERSION = "14.6.3";

//region Helper Methods

Expand Down Expand Up @@ -633,6 +633,12 @@
valueSub: "value-sub"
};

// Namespaces of internal event listeners
var INTERNAL_EVENT_NS = {
tooltips: ".__tooltips",
aria: ".__aria"
};

//endregion

function validateFormat(entry) {
Expand Down Expand Up @@ -1243,7 +1249,7 @@

function removeTooltips() {
if (scope_Tooltips) {
removeEvent("update.tooltips");
removeEvent("update" + INTERNAL_EVENT_NS.tooltips);
scope_Tooltips.forEach(function(tooltip) {
if (tooltip) {
removeElement(tooltip);
Expand All @@ -1260,7 +1266,7 @@
// Tooltips are added with options.tooltips in original order.
scope_Tooltips = scope_Handles.map(addTooltip);

bindEvent("update.tooltips", function(values, handleNumber, unencoded) {
bindEvent("update" + INTERNAL_EVENT_NS.tooltips, function(values, handleNumber, unencoded) {
if (!scope_Tooltips[handleNumber]) {
return;
}
Expand All @@ -1276,7 +1282,8 @@
}

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

function isInternalNamespace(namespace) {
return namespace === INTERNAL_EVENT_NS.aria || namespace === INTERNAL_EVENT_NS.tooltips;
}

// Undo attachment of event
function removeEvent(namespacedEvent) {
var event = namespacedEvent && namespacedEvent.split(".")[0];
var namespace = event && namespacedEvent.substring(event.length);
var namespace = event ? namespacedEvent.substring(event.length) : namespacedEvent;

Object.keys(scope_Events).forEach(function(bind) {
var tEvent = bind.split(".")[0];
var tNamespace = bind.substring(tEvent.length);

if ((!event || event === tEvent) && (!namespace || namespace === tNamespace)) {
delete scope_Events[bind];
// only delete protected internal event if intentional
if (!isInternalNamespace(tNamespace) || namespace === tNamespace) {
delete scope_Events[bind];
}
}
});
}
Expand Down Expand Up @@ -2446,6 +2459,10 @@

// Removes classes from the root and empties it.
function destroy() {
// remove protected internal listeners
removeEvent(INTERNAL_EVENT_NS.aria);
removeEvent(INTERNAL_EVENT_NS.tooltips);

for (var key in options.cssClasses) {
if (!options.cssClasses.hasOwnProperty(key)) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions distribute/nouislider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nouislider",
"version": "14.6.2",
"version": "14.6.3",
"main": "distribute/nouislider.js",
"style": "distribute/nouislider.min.css",
"license": "MIT",
Expand Down

0 comments on commit eca62f9

Please sign in to comment.