vrembem 1.40.2 → 1.40.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,10 +39,9 @@
39
39
  };
40
40
 
41
41
  /**
42
- * Adds a class or classes to an element or NodeList
43
- * ---
44
- * @param {Node || NodeList} el - Element(s) to add class(es) to
45
- * @param {String || Array} cl - Class(es) to add
42
+ * Adds a class or classes to a Node or NodeList.
43
+ * @param {Node || NodeList} el - Element(s) to add class(es) to.
44
+ * @param {String || Array} cl - Class(es) to add.
46
45
  */
47
46
  var addClass = function addClass(el) {
48
47
  var _arguments = arguments;
@@ -55,10 +54,9 @@
55
54
  };
56
55
 
57
56
  /**
58
- * Takes a hyphen cased string and converts it to camel case
59
- * ---
60
- * @param {String } str - the string to convert to camel case
61
- * @returns {Boolean} - returns a camel cased string
57
+ * Takes a hyphen cased string and converts it to camel case.
58
+ * @param {String } str - the string to convert to camel case.
59
+ * @returns {Boolean} - returns a camel cased string.
62
60
  */
63
61
  var camelCase = function camelCase(str) {
64
62
  return str.replace(/-([a-z])/g, function (g) {
@@ -184,27 +182,25 @@
184
182
  }();
185
183
 
186
184
  /**
187
- * Get an element(s) from a selector or return value if not a string
188
- * ---
189
- * @param {String} selector - Selector to query
190
- * @param {Boolean} single - Whether to return a single or all matches
185
+ * Get an element(s) from a selector or return value if not a string.
186
+ * @param {String} selector - Selector to query.
187
+ * @param {Boolean} single - Whether to return a single or all matches.
191
188
  */
192
189
  var getElement = function getElement(selector, single) {
193
190
  if (single === void 0) {
194
191
  single = 0;
195
192
  }
196
193
 
197
- if (typeof selector != 'string') return selector;
194
+ if (typeof selector !== 'string') return selector;
198
195
  return single ? document.querySelector(selector) : document.querySelectorAll(selector);
199
196
  };
200
197
 
201
198
  /**
202
- * Checks an element or NodeList whether they contain a class or classes
199
+ * Checks an element or NodeList whether they contain a class or classes.
203
200
  * Ref: https://davidwalsh.name/nodelist-array
204
- * ---
205
- * @param {Node} el - Element(s) to check class(es) on
206
- * @param {String || Array} c - Class(es) to check
207
- * @returns {Boolean} - Returns true if class exists, otherwise false
201
+ * @param {Node} el - Element(s) to check class(es) on.
202
+ * @param {String || Array} c - Class(es) to check.
203
+ * @returns {Boolean} - Returns true if class exists, otherwise false.
208
204
  */
209
205
  var hasClass = function hasClass(el) {
210
206
  el = el.forEach ? el : [el];
@@ -217,10 +213,9 @@
217
213
  };
218
214
 
219
215
  /**
220
- * Takes a camel cased string and converts it to hyphen case
221
- * ---
222
- * @param {String } str - the string to convert to hyphen case
223
- * @returns {Boolean} - returns a hyphen cased string
216
+ * Takes a camel cased string and converts it to hyphen case.
217
+ * @param {String } str - the string to convert to hyphen case.
218
+ * @returns {Boolean} - returns a hyphen cased string.
224
219
  */
225
220
  var hyphenCase = function hyphenCase(str) {
226
221
  return str.replace(/([a-z][A-Z])/g, function (g) {
@@ -229,11 +224,10 @@
229
224
  };
230
225
 
231
226
  /**
232
- * Moves element(s) in the DOM based on a reference and move type
233
- * ---
234
- * @param {String} target - The element(s) to move
235
- * @param {String} type - Move type can be 'after', 'before', 'append' or 'prepend'
236
- * @param {String} reference - The reference element the move is relative to
227
+ * Moves element(s) in the DOM based on a reference and move type.
228
+ * @param {String} target - The element(s) to move.
229
+ * @param {String} type - Move type can be 'after', 'before', 'append' or 'prepend'.
230
+ * @param {String} reference - The reference element the move is relative to.
237
231
  */
238
232
 
239
233
  function moveElement(target, type, reference) {
@@ -288,10 +282,9 @@
288
282
  }
289
283
 
290
284
  /**
291
- * Remove a class or classes from an element or NodeList
292
- * ---
293
- * @param {Node || NodeList} el - Element(s) to remove class(es) from
294
- * @param {String || Array} cl - Class(es) to remove
285
+ * Remove a class or classes from an element or NodeList.
286
+ * @param {Node || NodeList} el - Element(s) to remove class(es) from.
287
+ * @param {String || Array} cl - Class(es) to remove.
295
288
  */
296
289
  var removeClass = function removeClass(el) {
297
290
  var _arguments = arguments;
@@ -304,10 +297,9 @@
304
297
  };
305
298
 
306
299
  /**
307
- * Toggle a class or classes on an element or NodeList
308
- * ---
309
- * @param {Node || NodeList} el - Element(s) to toggle class(es) on
310
- * @param {String || Array} cl - Class(es) to toggle
300
+ * Toggle a class or classes on an element or NodeList.
301
+ * @param {Node || NodeList} el - Element(s) to toggle class(es) on.
302
+ * @param {String || Array} cl - Class(es) to toggle.
311
303
  */
312
304
  var toggleClass = function toggleClass(el) {
313
305
  var _arguments = arguments;
@@ -394,13 +386,15 @@
394
386
  return _extends.apply(this, arguments);
395
387
  }
396
388
 
389
+ var defaults$3 = {
390
+ autoInit: false,
391
+ stateAttr: 'aria-checked',
392
+ stateValue: 'mixed'
393
+ };
394
+
397
395
  var Checkbox = /*#__PURE__*/function () {
398
396
  function Checkbox(options) {
399
- this.defaults = {
400
- autoInit: false,
401
- stateAttr: 'aria-checked',
402
- stateValue: 'mixed'
403
- };
397
+ this.defaults = defaults$3;
404
398
  this.settings = _extends({}, this.defaults, options);
405
399
  this.__handlerClick = this.handlerClick.bind(this);
406
400
  if (this.settings.autoInit) this.init();
@@ -515,16 +509,23 @@
515
509
 
516
510
  var drawers = document.querySelectorAll("[data-" + this.parent.settings.dataBreakpoint + "]");
517
511
  drawers.forEach(function (drawer) {
512
+ // Setup mediaQueryList object
518
513
  var id = drawer.getAttribute("data-" + _this.parent.settings.dataDrawer);
519
514
  var key = drawer.getAttribute("data-" + _this.parent.settings.dataBreakpoint);
520
515
 
521
516
  var bp = _this.getBreakpoint(key);
522
517
 
523
- var mql = window.matchMedia('(min-width:' + bp + ')');
518
+ var mql = window.matchMedia('(min-width:' + bp + ')'); // Run match check
524
519
 
525
- _this.match(mql, drawer);
520
+ _this.match(mql, drawer); // Conditionally use addListner() for IE11 support
521
+
522
+
523
+ if (typeof mql.addEventListener === 'function') {
524
+ mql.addEventListener('change', _this.__check);
525
+ } else {
526
+ mql.addListener(_this.__check);
527
+ } // Push to mediaQueryLists array along with drawer ID
526
528
 
527
- mql.addEventListener('change', _this.__check);
528
529
 
529
530
  _this.mediaQueryLists.push({
530
531
  'mql': mql,