@angular-wave/angular.ts 0.0.45 → 0.0.47

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.
@@ -10,7 +10,7 @@ import {
10
10
  isString,
11
11
  isUndefined,
12
12
  lowercase,
13
- nodeName_,
13
+ getNodeName,
14
14
  shallowCopy,
15
15
  } from "../../shared/utils";
16
16
  import { CACHE, EXPANDO } from "../../core/cache/cache";
@@ -55,7 +55,6 @@ import { CACHE, EXPANDO } from "../../core/cache/cache";
55
55
  * - [`removeData()`](http://api.jquery.com/removeData/)
56
56
  * - [`replaceWith()`](http://api.jquery.com/replaceWith/)
57
57
  * - [`text()`](http://api.jquery.com/text/)
58
- * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers
59
58
  * - [`val()`](http://api.jquery.com/val/)
60
59
  *
61
60
  * ## jQuery/jqLite Extras
@@ -136,7 +135,7 @@ const BOOLEAN_ELEMENTS = {};
136
135
  * JQLite both a function and an array-like data structure for manipulation of DOM, linking elements to expando cache,
137
136
  * and execution of chain functions.
138
137
  *
139
- * @param {string|Element|Document|Window|JQLite|ArrayLike<Element>|(() => void)} element
138
+ * @param {string|Element|Comment|Document|Window|JQLite|ArrayLike<Element>|(() => void)} element
140
139
  * @returns {JQLite}
141
140
  */
142
141
  export function JQLite(element) {
@@ -261,7 +260,7 @@ JQLite.prototype.injector = function () {
261
260
  */
262
261
  JQLite.prototype.on = function (type, fn) {
263
262
  // Do not add event handlers to non-elements because they will not be cleaned up.
264
- for (let i = 0, ii = this.length; i < ii; i++) {
263
+ for (let i = 0; i < this.length; i++) {
265
264
  const element = this[i];
266
265
  if (!elementAcceptsData(element)) {
267
266
  return;
@@ -311,7 +310,7 @@ JQLite.prototype.on = function (type, fn) {
311
310
  * @returns {JQLite}
312
311
  */
313
312
  JQLite.prototype.off = function (type, fn) {
314
- for (let i = 0, ii = this.length; i < ii; i++) {
313
+ for (let i = 0; i < this.length; i++) {
315
314
  const element = this[i];
316
315
  const expandoStore = getExpando(element);
317
316
  const events = expandoStore && expandoStore.events;
@@ -357,7 +356,7 @@ JQLite.prototype.off = function (type, fn) {
357
356
  * @returns {JQLite}
358
357
  */
359
358
  JQLite.prototype.removeData = function (name) {
360
- for (let i = 0, ii = this.length; i < ii; i++) {
359
+ for (let i = 0; i < this.length; i++) {
361
360
  const element = this[i];
362
361
  removeElementData(element, name);
363
362
  }
@@ -371,7 +370,7 @@ JQLite.prototype.removeData = function (name) {
371
370
  * @returns {JQLite|any}
372
371
  */
373
372
  JQLite.prototype.inheritedData = function (name, value) {
374
- for (let i = 0, ii = this.length; i < ii; i++) {
373
+ for (let i = 0; i < this.length; i++) {
375
374
  const element = this[0];
376
375
  let res = getInheritedData(element, name, value);
377
376
  if (value) {
@@ -398,281 +397,382 @@ JQLite.prototype.html = function (value) {
398
397
  return this;
399
398
  };
400
399
 
401
- /// ///////////////////////////////////////
402
- // Functions iterating getter/setters.
403
- // these functions return self on setter and
404
- // value on get.
405
- /// ///////////////////////////////////////
406
- forEach(
407
- {
408
- data: getOrSetCacheData,
409
- attr(element, name, value) {
410
- let ret;
400
+ /**
401
+ * Get the combined text contents of each element in the JQLite collection
402
+ * or set the text contents of all elements.
403
+ * @param {string} [value]
404
+ * @returns {JQLite|string}
405
+ */
406
+ JQLite.prototype.text = function (value) {
407
+ let res = "";
408
+ for (let i = 0; i < this.length; i++) {
409
+ const element = this[i];
410
+ if (isUndefined(value)) {
411
+ // read
411
412
  const { nodeType } = element;
412
- if (
413
- nodeType === Node.TEXT_NODE ||
414
- nodeType === Node.ATTRIBUTE_NODE ||
415
- nodeType === Node.COMMENT_NODE ||
416
- !element.getAttribute
417
- ) {
418
- return;
419
- }
413
+ res +=
414
+ nodeType === Node.ELEMENT_NODE || nodeType === Node.TEXT_NODE
415
+ ? element.textContent
416
+ : "";
417
+ } else {
418
+ // write
419
+ element.textContent = value;
420
+ }
421
+ }
420
422
 
421
- const lowercasedName = lowercase(name);
422
- const isBooleanAttr = BOOLEAN_ATTR[lowercasedName];
423
+ if (isUndefined(value)) {
424
+ return res;
425
+ } else {
426
+ return this;
427
+ }
428
+ };
423
429
 
424
- if (isDefined(value)) {
425
- // setter
430
+ /**
431
+ * Gets or sets the values of form elements such as input, select and textarea in a JQLite collection.
432
+ * @param {any} value
433
+ * @returns {JQLite|any}
434
+ */
435
+ JQLite.prototype.val = function (value) {
436
+ // We can only get or set a value of
437
+ for (let i = 0; i < this.length; i++) {
438
+ const element = this[i];
439
+ if (isUndefined(value)) {
440
+ // read
441
+ if (element.multiple && getNodeName(element) === "select") {
442
+ const result = [];
443
+ forEach(element.options, (option) => {
444
+ if (option.selected) {
445
+ result.push(option.value || option.text);
446
+ }
447
+ });
448
+ return result;
449
+ }
450
+ return element.value;
451
+ } else {
452
+ // write
453
+ element.value = value;
454
+ return this;
455
+ }
456
+ }
457
+ };
426
458
 
427
- if (value === null || (value === false && isBooleanAttr)) {
428
- element.removeAttribute(name);
429
- } else {
430
- element.setAttribute(name, isBooleanAttr ? lowercasedName : value);
431
- }
432
- } else {
433
- // getter
459
+ /**
460
+ * @param {string|Object} name
461
+ * @param {any} value
462
+ * @returns
463
+ */
464
+ JQLite.prototype.attr = function (name, value) {
465
+ for (let i = 0; i < this.length; i++) {
466
+ const element = this[i];
467
+ let ret;
468
+ const { nodeType } = element;
469
+ if (
470
+ nodeType === Node.TEXT_NODE ||
471
+ nodeType === Node.ATTRIBUTE_NODE ||
472
+ nodeType === Node.COMMENT_NODE ||
473
+ !element.getAttribute
474
+ ) {
475
+ continue;
476
+ }
434
477
 
435
- ret = element.getAttribute(name);
478
+ const lowercasedName = lowercase(name);
479
+ const isBooleanAttr = BOOLEAN_ATTR[lowercasedName];
436
480
 
437
- if (isBooleanAttr && ret !== null) {
438
- ret = lowercasedName;
439
- }
440
- // Normalize non-existing attributes to undefined (as jQuery).
441
- return ret === null ? undefined : ret;
442
- }
443
- },
444
- text: (function () {
445
- getText.$dv = "";
446
- return getText;
447
-
448
- function getText(element, value) {
449
- if (isUndefined(value)) {
450
- const { nodeType } = element;
451
- return nodeType === Node.ELEMENT_NODE || nodeType === Node.TEXT_NODE
452
- ? element.textContent
453
- : "";
454
- }
455
- element.textContent = value;
481
+ if (isObject(name)) {
482
+ for (let key in name) {
483
+ element.setAttribute(key, isBooleanAttr ? lowercasedName : name[key]);
456
484
  }
457
- })(),
458
- val(element, value) {
459
- if (isUndefined(value)) {
460
- if (element.multiple && nodeName_(element) === "select") {
461
- const result = [];
462
- forEach(element.options, (option) => {
463
- if (option.selected) {
464
- result.push(option.value || option.text);
465
- }
466
- });
467
- return result;
468
- }
469
- return element.value;
485
+ } else if (isDefined(value)) {
486
+ // setter
487
+
488
+ if (value === null || (value === false && isBooleanAttr)) {
489
+ element.removeAttribute(name);
490
+ } else {
491
+ element.setAttribute(name, isBooleanAttr ? lowercasedName : value);
470
492
  }
471
- element.value = value;
472
- },
473
- },
474
- (fn, name) => {
475
- /**
476
- * Properties: writes return selection, reads return first value
477
- */
478
- JQLite.prototype[name] = function (arg1, arg2) {
479
- let i;
480
- let key;
481
- const nodeCount = this.length;
482
-
483
- // JQLiteEmpty takes no arguments but is a setter.
484
- if (isUndefined(fn.length === 2 && fn !== getController ? arg1 : arg2)) {
485
- if (isObject(arg1)) {
486
- // we are a write, but the object properties are the key/values
487
- for (i = 0; i < nodeCount; i++) {
488
- if (fn === getOrSetCacheData) {
489
- fn(this[i], arg1);
490
- } else {
491
- for (key in arg1) {
492
- fn(this[i], key, arg1[key]);
493
- }
494
- }
495
- }
496
- // return self for chaining
497
- return this;
498
- }
499
- // we are a read, so read the first child.
500
- // TODO: do we still need this?
501
- let value = fn.$dv;
502
- // Only if we have $dv do we iterate over all, otherwise it is just the first element.
503
- const jj = isUndefined(value) ? Math.min(nodeCount, 1) : nodeCount;
504
- for (let j = 0; j < jj; j++) {
505
- const nodeValue = fn(this[j], arg1, arg2);
506
- value = value ? value + nodeValue : nodeValue;
507
- }
508
- return value;
493
+ } else {
494
+ // getter
495
+ ret = element.getAttribute(name);
496
+ if (isBooleanAttr && ret !== null) {
497
+ ret = lowercasedName;
509
498
  }
510
- // we are a write, so apply to all children
499
+ // Normalize non-existing attributes to undefined (as jQuery).
500
+ return ret === null ? undefined : ret;
501
+ }
502
+ }
503
+
504
+ if (isDefined(value) || isObject(name)) {
505
+ return this;
506
+ }
507
+ };
508
+
509
+ /**
510
+ * @param {string|any} key - The key (as a string) to get/set or an object for mass-setting.
511
+ * @param {any} [value] - The value to set. If not provided, the function acts as a getter.
512
+ * @returns {JQLite|any} - The retrieved data if acting as a getter. Otherwise, returns undefined.
513
+ */
514
+ JQLite.prototype.data = function (key, value) {
515
+ let i;
516
+ const nodeCount = this.length;
517
+ if (isUndefined(value)) {
518
+ if (isObject(key)) {
519
+ // we are a write, but the object properties are the key/values
511
520
  for (i = 0; i < nodeCount; i++) {
512
- fn(this[i], arg1, arg2);
521
+ getOrSetCacheData(this[i], key);
513
522
  }
514
- // return self for chaining
515
523
  return this;
516
- };
517
- },
518
- );
524
+ }
525
+ // we are a read, so read the first child.
526
+ const jj = isUndefined(value) ? Math.min(nodeCount, 1) : nodeCount;
527
+ for (let j = 0; j < jj; j++) {
528
+ const nodeValue = getOrSetCacheData(this[j], key, value);
529
+ value = value ? value + nodeValue : nodeValue;
530
+ }
531
+ return value;
532
+ }
533
+ // we are a write, so apply to all children
534
+ for (i = 0; i < nodeCount; i++) {
535
+ getOrSetCacheData(this[i], key, value);
536
+ }
537
+ return this;
538
+ };
519
539
 
520
- /// ///////////////////////////////////////
521
- // Functions iterating traversal.
522
- // These functions chain results into a single
523
- // selector.
524
- /// ///////////////////////////////////////
525
- forEach(
526
- {
527
- replaceWith(element, replaceNode) {
528
- let index;
529
- const parent = element.parentNode;
530
- dealoc(element);
531
- forEach(new JQLite(replaceNode), (node) => {
532
- if (index) {
533
- parent.insertBefore(node, index.nextSibling);
534
- } else {
535
- parent.replaceChild(node, element);
536
- }
537
- index = node;
538
- });
539
- },
540
- children(element) {
541
- return Array.from(element.childNodes).filter(
542
- (child) => child.nodeType === Node.ELEMENT_NODE,
543
- );
544
- },
545
- append(element, node) {
546
- const { nodeType } = element;
547
- if (
548
- nodeType !== Node.ELEMENT_NODE &&
549
- nodeType !== Node.DOCUMENT_FRAGMENT_NODE
550
- )
551
- return;
540
+ JQLite.prototype.replaceWith = function (arg1) {
541
+ let value;
542
+ let fn = function (element, replaceNode) {
543
+ let index;
544
+ const parent = element.parentNode;
545
+ dealoc(element);
546
+ forEach(new JQLite(replaceNode), (node) => {
547
+ if (index) {
548
+ parent.insertBefore(node, index.nextSibling);
549
+ } else {
550
+ parent.replaceChild(node, element);
551
+ }
552
+ index = node;
553
+ });
554
+ };
555
+ for (let i = 0; i < this.length; i++) {
556
+ if (isUndefined(value)) {
557
+ value = fn(this[i], arg1);
558
+ if (isDefined(value)) {
559
+ // any function which returns a value needs to be wrapped
560
+ value = JQLite(value);
561
+ }
562
+ } else {
563
+ addNodes(value, fn(this[i], arg1));
564
+ }
565
+ }
566
+ return isDefined(value) ? value : this;
567
+ };
552
568
 
553
- node = new JQLite(node);
569
+ JQLite.prototype.children = function () {
570
+ let value;
571
+ let fn = (element) =>
572
+ Array.from(element.childNodes).filter(
573
+ (child) => child.nodeType === Node.ELEMENT_NODE,
574
+ );
575
+ for (let i = 0; i < this.length; i++) {
576
+ value = JQLite(fn(this[i]));
577
+ }
578
+ return isDefined(value) ? value : this;
579
+ };
554
580
 
555
- for (let i = 0, ii = node.length; i < ii; i++) {
556
- const child = node[i];
557
- element.appendChild(child);
558
- }
559
- },
581
+ /**
582
+ * @param {string} node
583
+ * @returns {JQLite}
584
+ */
585
+ JQLite.prototype.append = function (node) {
586
+ for (let i = 0; i < this.length; i++) {
587
+ const element = this[i];
588
+ const { nodeType } = element;
589
+ if (
590
+ nodeType !== Node.ELEMENT_NODE &&
591
+ nodeType !== Node.DOCUMENT_FRAGMENT_NODE
592
+ )
593
+ return this;
560
594
 
561
- prepend(element, node) {
562
- if (element.nodeType === Node.ELEMENT_NODE) {
563
- const index = element.firstChild;
564
- forEach(new JQLite(node), (child) => {
565
- element.insertBefore(child, index);
566
- });
567
- }
568
- },
595
+ let newNode = new JQLite(node);
569
596
 
570
- remove: removeElement,
597
+ for (let i = 0; i < newNode.length; i++) {
598
+ const child = newNode[i];
599
+ element.appendChild(child);
600
+ }
601
+ }
602
+ return this;
603
+ };
571
604
 
572
- detach(element) {
573
- removeElement(element, true);
574
- },
605
+ /**
606
+ * @param {string} node
607
+ * @returns {JQLite}
608
+ */
609
+ JQLite.prototype.prepend = function (node) {
610
+ for (let i = 0; i < this.length; i++) {
611
+ const element = this[i];
612
+ if (element.nodeType === Node.ELEMENT_NODE) {
613
+ const index = element.firstChild;
614
+ forEach(new JQLite(node), (child) => {
615
+ element.insertBefore(child, index);
616
+ });
617
+ }
618
+ }
619
+ return this;
620
+ };
575
621
 
576
- after(element, newElement) {
577
- let index = element;
578
- const parent = element.parentNode;
622
+ /**
623
+ * @param {string} newElement
624
+ * @returns {JQLite}
625
+ */
626
+ JQLite.prototype.after = function (newElement) {
627
+ for (let i = 0; i < this.length; i++) {
628
+ const element = this[i];
629
+ let index = element;
630
+ const parent = element.parentNode;
579
631
 
580
- if (parent) {
581
- newElement = new JQLite(newElement);
632
+ if (parent) {
633
+ let el = new JQLite(newElement);
582
634
 
583
- for (let i = 0, ii = newElement.length; i < ii; i++) {
584
- const node = newElement[i];
585
- parent.insertBefore(node, index.nextSibling);
586
- index = node;
587
- }
635
+ for (let i = 0, ii = el.length; i < ii; i++) {
636
+ const node = el[i];
637
+ parent.insertBefore(node, index.nextSibling);
638
+ index = node;
639
+ }
640
+ }
641
+ }
642
+ return this;
643
+ };
644
+
645
+ /**
646
+ * @param {boolean} [keepData]
647
+ * @returns
648
+ */
649
+ JQLite.prototype.remove = function (keepData = false) {
650
+ for (let i = 0; i < this.length; i++) {
651
+ const element = this[i];
652
+ removeElement(element, keepData);
653
+ }
654
+ return this;
655
+ };
656
+
657
+ JQLite.prototype.detach = function () {
658
+ for (let i = 0; i < this.length; i++) {
659
+ const element = this[i];
660
+ removeElement(element, true);
661
+ }
662
+ return this;
663
+ };
664
+
665
+ JQLite.prototype.parent = function () {
666
+ let value;
667
+ let fn = (element) => {
668
+ const parent = element.parentNode;
669
+ return parent && parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE
670
+ ? parent
671
+ : null;
672
+ };
673
+ for (let i = 0, ii = this.length; i < ii; i++) {
674
+ if (isUndefined(value)) {
675
+ value = fn(this[i]);
676
+ if (isDefined(value)) {
677
+ value = JQLite(value);
588
678
  }
589
- },
679
+ } else {
680
+ addNodes(value, fn(this[i]));
681
+ }
682
+ }
683
+ return isDefined(value) ? value : this;
684
+ };
590
685
 
591
- parent(element) {
592
- const parent = element.parentNode;
593
- return parent && parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE
594
- ? parent
595
- : null;
596
- },
686
+ JQLite.prototype.find = function (selector) {
687
+ let value;
688
+ for (let i = 0, ii = this.length; i < ii; i++) {
689
+ const element = this[i];
597
690
 
598
- // TODO: remove after migrating tests away from JQLite
599
- find(element, selector) {
691
+ if (isUndefined(value)) {
600
692
  if (element.getElementsByTagName) {
601
- return element.getElementsByTagName(selector);
693
+ value = element.getElementsByTagName(selector);
694
+ } else {
695
+ value = [];
602
696
  }
603
- return [];
604
- },
605
-
606
- triggerHandler(element, event, extraParameters) {
607
- let dummyEvent;
608
- let eventFnsCopy;
609
- let handlerArgs;
610
- const eventName = event.type || event;
611
- const expandoStore = getExpando(element);
612
- const events = expandoStore && expandoStore.events;
613
- const eventFns = events && events[eventName];
614
-
615
- if (eventFns) {
616
- // Create a dummy event to pass to the handlers
617
- dummyEvent = {
618
- preventDefault() {
619
- this.defaultPrevented = true;
620
- },
621
- isDefaultPrevented() {
622
- return this.defaultPrevented === true;
623
- },
624
- stopImmediatePropagation() {
625
- this.immediatePropagationStopped = true;
626
- },
627
- isImmediatePropagationStopped() {
628
- return this.immediatePropagationStopped === true;
629
- },
630
- stopPropagation: () => {},
631
- type: eventName,
632
- target: element,
633
- };
634
-
635
- // If a custom event was provided then extend our dummy event with it
636
- if (event.type) {
637
- dummyEvent = extend(dummyEvent, event);
638
- }
697
+ if (isDefined(value)) {
698
+ // any function which returns a value needs to be wrapped
699
+ value = JQLite(value);
700
+ }
701
+ } else {
702
+ if (element.getElementsByTagName) {
703
+ addNodes(value, element.getElementsByTagName(selector));
704
+ }
705
+ }
706
+ }
707
+ return isDefined(value) ? value : this;
708
+ };
639
709
 
640
- // Copy event handlers in case event handlers array is modified during execution.
641
- eventFnsCopy = shallowCopy(eventFns);
642
- handlerArgs = extraParameters
643
- ? [dummyEvent].concat(extraParameters)
644
- : [dummyEvent];
710
+ /**
711
+ * TODO: REMOVE! This function being used ONLY in tests!
712
+ */
713
+ JQLite.prototype.triggerHandler = function (event, extraParameters) {
714
+ let value;
715
+ let fn = function (element, event, extraParameters) {
716
+ let dummyEvent;
717
+ let eventFnsCopy;
718
+ let handlerArgs;
719
+ const eventName = event.type || event;
720
+ const expandoStore = getExpando(element);
721
+ const events = expandoStore && expandoStore.events;
722
+ const eventFns = events && events[eventName];
723
+
724
+ if (eventFns) {
725
+ // Create a dummy event to pass to the handlers
726
+ dummyEvent = {
727
+ preventDefault() {
728
+ this.defaultPrevented = true;
729
+ },
730
+ isDefaultPrevented() {
731
+ return this.defaultPrevented === true;
732
+ },
733
+ stopImmediatePropagation() {
734
+ this.immediatePropagationStopped = true;
735
+ },
736
+ isImmediatePropagationStopped() {
737
+ return this.immediatePropagationStopped === true;
738
+ },
739
+ stopPropagation: () => {},
740
+ type: eventName,
741
+ target: element,
742
+ };
645
743
 
646
- forEach(eventFnsCopy, (fn) => {
647
- if (!dummyEvent.isImmediatePropagationStopped()) {
648
- fn.apply(element, handlerArgs);
649
- }
650
- });
744
+ // If a custom event was provided then extend our dummy event with it
745
+ if (event.type) {
746
+ dummyEvent = extend(dummyEvent, event);
651
747
  }
652
- },
653
- },
654
- (fn, name) => {
655
- /**
656
- * chaining functions
657
- */
658
- JQLite.prototype[name] = function (arg1, arg2, arg3) {
659
- let value;
660
-
661
- for (let i = 0, ii = this.length; i < ii; i++) {
662
- if (isUndefined(value)) {
663
- value = fn(this[i], arg1, arg2, arg3);
664
- if (isDefined(value)) {
665
- // any function which returns a value needs to be wrapped
666
- value = JQLite(value);
667
- }
668
- } else {
669
- addNodes(value, fn(this[i], arg1, arg2, arg3));
748
+
749
+ // Copy event handlers in case event handlers array is modified during execution.
750
+ eventFnsCopy = shallowCopy(eventFns);
751
+ handlerArgs = extraParameters
752
+ ? [dummyEvent].concat(extraParameters)
753
+ : [dummyEvent];
754
+
755
+ forEach(eventFnsCopy, (fn) => {
756
+ if (!dummyEvent.isImmediatePropagationStopped()) {
757
+ fn.apply(element, handlerArgs);
670
758
  }
759
+ });
760
+ }
761
+ };
762
+ for (let i = 0, ii = this.length; i < ii; i++) {
763
+ if (isUndefined(value)) {
764
+ value = fn(this[i], event, extraParameters);
765
+ if (isDefined(value)) {
766
+ // @ts-ignore
767
+ value = JQLite(value);
671
768
  }
672
- return isDefined(value) ? value : this;
673
- };
674
- },
675
- );
769
+ } else {
770
+ // @ts-ignore
771
+ addNodes(value, fn(this[i], event, extraParameters));
772
+ }
773
+ }
774
+ return isDefined(value) ? value : this;
775
+ };
676
776
 
677
777
  ///////////////////////////////////////////////////////////////////
678
778
  //////////// HELPER FUNCTIONS /////////////////////////
@@ -955,7 +1055,7 @@ function getController(element, name) {
955
1055
  /**
956
1056
  *
957
1057
  * @param {Element} element
958
- * @param {string} name
1058
+ * @param {string|string[]} name
959
1059
  * @param {any} [value]
960
1060
  * @returns
961
1061
  */
@@ -1136,13 +1236,13 @@ export function getBooleanAttrName(element, name) {
1136
1236
  const booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
1137
1237
 
1138
1238
  // booleanAttr is here twice to minimize DOM access
1139
- return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;
1239
+ return booleanAttr && BOOLEAN_ELEMENTS[getNodeName(element)] && booleanAttr;
1140
1240
  }
1141
1241
 
1142
1242
  /**
1143
1243
  * Takes an array of elements, calls any `$destroy` event handlers, removes any data in cache, and finally removes any
1144
1244
  * listeners.
1145
- * @param {NodeListOf<Element>} nodes
1245
+ * @param {NodeListOf<Element>|Element[]} nodes
1146
1246
  */
1147
1247
  export function cleanElementData(nodes) {
1148
1248
  for (let i = 0, ii = nodes.length; i < ii; i++) {