@danielgindi/dom-utils 1.0.7 → 1.0.9

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.
package/dist/lib.es6.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/dom-utils 1.0.7
2
+ * @danielgindi/dom-utils 1.0.9
3
3
  * git://github.com/danielgindi/dom-utils.git
4
4
  */
5
5
  /**
@@ -382,6 +382,11 @@ const isTimeString = (value) => {
382
382
  return /^-?(0?\.)?\d+m?s$/.test(value);
383
383
  };
384
384
 
385
+ /**
386
+ *
387
+ * @param {string} transition
388
+ * @return {{duration: number, delay: number, name: string, timingFunction: string?}}
389
+ */
385
390
  const parseSingleTransition = (transition) => {
386
391
  let parts = transition.split(/\s+/),
387
392
  name = parts[0],
@@ -405,8 +410,14 @@ const parseSingleTransition = (transition) => {
405
410
  };
406
411
  };
407
412
 
413
+ /**
414
+ *
415
+ * @param {string} transition
416
+ * @return {{duration: number, delay: number, name: string, timingFunction: string?}[]}
417
+ */
408
418
  const parseTransition = (transition) => {
409
- return transition.match(/([^,()]|\([^)]*\))+/g).map(value => value.trim()).filter(value => value.length > 0).map(parseSingleTransition);
419
+ if (!transition) return [];
420
+ return (transition.match(/([^,()]|\([^)]*\))+/g) ?? []).map(value => value.trim()).filter(value => value.length > 0).map(parseSingleTransition);
410
421
  };
411
422
 
412
423
  var Css = /*#__PURE__*/Object.freeze({
@@ -605,8 +616,7 @@ const remove = function (el) {
605
616
 
606
617
  if ('remove' in el)
607
618
  el.remove();
608
-
609
- if (el.parentNode)
619
+ else if (el.parentNode)
610
620
  el.parentNode.removeChild(el);
611
621
  };
612
622
 
@@ -739,7 +749,7 @@ const detectScopedSelectorFeature = () => {
739
749
  try {
740
750
  document.createElement('div').querySelector(':scope > div');
741
751
  hasScopedQuerySelector = true;
742
- } catch (err) {
752
+ } catch (ignored) {
743
753
  hasScopedQuerySelector = false;
744
754
  }
745
755
  };