Skip to content

Commit a86228f

Browse files
committed
noUiSlider 14.3.0
1 parent d6c2af7 commit a86228f

File tree

7 files changed

+60
-47
lines changed

7 files changed

+60
-47
lines changed

CHANGELOG.MD

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

3+
### 14.3.0 (*2020-05-05*)
4+
- Added: Default `cssClasses` are now exposed and can be modified;
5+
- Fixed: Destroying sliders with multiple classes in `cssClasses` fails (#1069);
6+
37
### 14.2.0 (*2020-03-27*)
48
- Added: Slider api as event parameter (#1058);
59
- Added: Allow multiple classes in `cssClasses` option (#1054);

distribute/nouislider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! nouislider - 14.2.0 - 3/27/2020 */
1+
/*! nouislider - 14.3.0 - 5/5/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: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! nouislider - 14.2.0 - 3/27/2020 */
1+
/*! nouislider - 14.3.0 - 5/5/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.2.0";
16+
var VERSION = "14.3.0";
1717

1818
//region Helper Methods
1919

@@ -109,7 +109,7 @@
109109

110110
// http://youmightnotneedjquery.com/#remove_class
111111
function removeClass(el, className) {
112-
if (el.classList) {
112+
if (el.classList && !/\s/.test(className)) {
113113
el.classList.remove(className);
114114
} else {
115115
el.className = el.className.replace(
@@ -492,13 +492,56 @@
492492
or true when everything is OK. It can also modify the option
493493
object, to make sure all values can be correctly looped elsewhere. */
494494

495+
//region Defaults
496+
495497
var defaultFormatter = {
496498
to: function(value) {
497499
return value !== undefined && value.toFixed(2);
498500
},
499501
from: Number
500502
};
501503

504+
var cssClasses = {
505+
target: "target",
506+
base: "base",
507+
origin: "origin",
508+
handle: "handle",
509+
handleLower: "handle-lower",
510+
handleUpper: "handle-upper",
511+
touchArea: "touch-area",
512+
horizontal: "horizontal",
513+
vertical: "vertical",
514+
background: "background",
515+
connect: "connect",
516+
connects: "connects",
517+
ltr: "ltr",
518+
rtl: "rtl",
519+
textDirectionLtr: "txt-dir-ltr",
520+
textDirectionRtl: "txt-dir-rtl",
521+
draggable: "draggable",
522+
drag: "state-drag",
523+
tap: "state-tap",
524+
active: "active",
525+
tooltip: "tooltip",
526+
pips: "pips",
527+
pipsHorizontal: "pips-horizontal",
528+
pipsVertical: "pips-vertical",
529+
marker: "marker",
530+
markerHorizontal: "marker-horizontal",
531+
markerVertical: "marker-vertical",
532+
markerNormal: "marker-normal",
533+
markerLarge: "marker-large",
534+
markerSub: "marker-sub",
535+
value: "value",
536+
valueHorizontal: "value-horizontal",
537+
valueVertical: "value-vertical",
538+
valueNormal: "value-normal",
539+
valueLarge: "value-large",
540+
valueSub: "value-sub"
541+
};
542+
543+
//endregion
544+
502545
function validateFormat(entry) {
503546
// Any object with a to and from method is supported.
504547
if (isValidFormatter(entry)) {
@@ -878,44 +921,7 @@
878921
orientation: "horizontal",
879922
keyboardSupport: true,
880923
cssPrefix: "noUi-",
881-
cssClasses: {
882-
target: "target",
883-
base: "base",
884-
origin: "origin",
885-
handle: "handle",
886-
handleLower: "handle-lower",
887-
handleUpper: "handle-upper",
888-
touchArea: "touch-area",
889-
horizontal: "horizontal",
890-
vertical: "vertical",
891-
background: "background",
892-
connect: "connect",
893-
connects: "connects",
894-
ltr: "ltr",
895-
rtl: "rtl",
896-
textDirectionLtr: "txt-dir-ltr",
897-
textDirectionRtl: "txt-dir-rtl",
898-
draggable: "draggable",
899-
drag: "state-drag",
900-
tap: "state-tap",
901-
active: "active",
902-
tooltip: "tooltip",
903-
pips: "pips",
904-
pipsHorizontal: "pips-horizontal",
905-
pipsVertical: "pips-vertical",
906-
marker: "marker",
907-
markerHorizontal: "marker-horizontal",
908-
markerVertical: "marker-vertical",
909-
markerNormal: "marker-normal",
910-
markerLarge: "marker-large",
911-
markerSub: "marker-sub",
912-
value: "value",
913-
valueHorizontal: "value-horizontal",
914-
valueVertical: "value-vertical",
915-
valueNormal: "value-normal",
916-
valueLarge: "value-large",
917-
valueSub: "value-sub"
918-
}
924+
cssClasses: cssClasses
919925
};
920926

921927
// AriaFormat defaults to regular format, if any.
@@ -2515,6 +2521,9 @@
25152521
// Exposed for unit testing, don't use this in your application.
25162522
__spectrum: Spectrum,
25172523
version: VERSION,
2524+
// A reference to the default classes, allows global changes.
2525+
// Use the cssClasses option for changes to one slider.
2526+
cssClasses: cssClasses,
25182527
create: initialize
25192528
};
25202529
});

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

tests/slider_classes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ QUnit.test("Classes", function (assert) {
22

33
document.getElementById('qunit-fixture').innerHTML = '<div class="slider"></div>';
44

5-
noUiSlider.cssClasses.base += ' test';
5+
noUiSlider.cssClasses.target += ' test';
66

77
var settings = {
88
start: [50, 100],

0 commit comments

Comments
 (0)