Skip to content

Commit f219423

Browse files
committed
noUiSlider 13.1.0
1 parent ce20522 commit f219423

File tree

6 files changed

+50
-13
lines changed

6 files changed

+50
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ An extensive documentation, including **examples**, **options** and **configurat
2020
Changelog
2121
---------
2222

23-
### 13.1.0 (*???*)
23+
### 13.1.0 (*2018-02-08*)
2424
- Fixed: Updating `pips` using `updateOptions` (#933);
2525
- Added: Updating `tooltips` using `updateOptions` (#946);
2626

distribute/nouislider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! nouislider - 13.0.0 - 2/6/2019 */
1+
/*! nouislider - 13.1.0 - 2/8/2019 */
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: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! nouislider - 13.0.0 - 2/6/2019 */
1+
/*! nouislider - 13.1.0 - 2/8/2019 */
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 = "13.0.0";
16+
var VERSION = "13.1.0";
1717

1818
function isValidFormatter(entry) {
1919
return typeof entry === "object" && typeof entry.to === "function" && typeof entry.from === "function";
@@ -958,6 +958,7 @@
958958
var scope_Handles;
959959
var scope_Connects;
960960
var scope_Pips;
961+
var scope_Tooltips;
961962

962963
// Override for the 'animate' option
963964
var scope_ShouldAnimate = true;
@@ -1094,13 +1095,27 @@
10941095
return handleOrigin.hasAttribute("disabled");
10951096
}
10961097

1098+
function removeTooltips() {
1099+
if (scope_Tooltips) {
1100+
removeEvent("update.tooltips");
1101+
scope_Tooltips.forEach(function(tooltip) {
1102+
if (tooltip) {
1103+
removeElement(tooltip);
1104+
}
1105+
});
1106+
scope_Tooltips = null;
1107+
}
1108+
}
1109+
10971110
// The tooltips option is a shorthand for using the 'update' event.
10981111
function tooltips() {
1112+
removeTooltips();
1113+
10991114
// Tooltips are added with options.tooltips in original order.
1100-
var tips = scope_Handles.map(addTooltip);
1115+
scope_Tooltips = scope_Handles.map(addTooltip);
11011116

1102-
bindEvent("update", function(values, handleNumber, unencoded) {
1103-
if (!tips[handleNumber]) {
1117+
bindEvent("update.tooltips", function(values, handleNumber, unencoded) {
1118+
if (!scope_Tooltips[handleNumber]) {
11041119
return;
11051120
}
11061121

@@ -1110,7 +1125,7 @@
11101125
formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);
11111126
}
11121127

1113-
tips[handleNumber].innerHTML = formattedValue;
1128+
scope_Tooltips[handleNumber].innerHTML = formattedValue;
11141129
});
11151130
}
11161131

@@ -2284,10 +2299,22 @@
22842299
// If 'snap' and 'step' are not passed, they should remain unchanged.
22852300
var v = valueGet();
22862301

2287-
var updateAble = ["margin", "limit", "padding", "range", "animate", "snap", "step", "format"];
2302+
var updateAble = [
2303+
"margin",
2304+
"limit",
2305+
"padding",
2306+
"range",
2307+
"animate",
2308+
"snap",
2309+
"step",
2310+
"format",
2311+
"pips",
2312+
"tooltips"
2313+
];
22882314

22892315
// Only change options that we're actually passed to update.
22902316
updateAble.forEach(function(name) {
2317+
// Check for undefined. null removes the value.
22912318
if (optionsToUpdate[name] !== undefined) {
22922319
originalOptions[name] = optionsToUpdate[name];
22932320
}
@@ -2312,6 +2339,15 @@
23122339
// Update pips, removes existing.
23132340
if (options.pips) {
23142341
pips(options.pips);
2342+
} else {
2343+
removePips();
2344+
}
2345+
2346+
// Update tooltips, removes existing.
2347+
if (options.tooltips) {
2348+
tooltips();
2349+
} else {
2350+
removeTooltips();
23152351
}
23162352

23172353
// Invalidate the current positioning so valueSet forces an update.
@@ -2364,6 +2400,7 @@
23642400
updateOptions: updateOptions,
23652401
target: scope_Target, // Issue #597
23662402
removePips: removePips,
2403+
removeTooltips: removeTooltips,
23672404
pips: pips // Issue #594
23682405
};
23692406

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": "13.0.0",
3+
"version": "13.1.0",
44
"main": "distribute/nouislider.js",
55
"style": "distribute/nouislider.min.css",
66
"license": "MIT",

0 commit comments

Comments
 (0)