@angular-wave/angular.ts 0.0.2 → 0.0.5

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.
@@ -619,6 +619,14 @@
619
619
  return Array.prototype.indexOf.call(array, obj) !== -1;
620
620
  }
621
621
 
622
+ /**
623
+ * Removes the first occurrence of a specified value from an array.
624
+ *
625
+ * @template T
626
+ * @param {Array<T>} array - The array from which to remove the value.
627
+ * @param {T} value - The value to remove.
628
+ * @returns {number} - The index of the removed value, or -1 if the value was not found.
629
+ */
622
630
  function arrayRemove(array, value) {
623
631
  const index = array.indexOf(value);
624
632
  if (index >= 0) {
@@ -1354,6 +1362,8 @@
1354
1362
  *
1355
1363
  */
1356
1364
 
1365
+ const EXPANDO = "ngId";
1366
+
1357
1367
  /**
1358
1368
  * Expando cache for adding properties to DOM nodes with JavaScript.
1359
1369
  * This used to be an Object in JQLite decorator, but swapped out for a Map
@@ -1468,18 +1478,8 @@
1468
1478
  * @returns {Object} jQuery object.
1469
1479
  */
1470
1480
 
1471
- JQLite.cache = CACHE;
1472
-
1473
- const EXPANDO = "ngId";
1474
1481
  let jqId = 1;
1475
1482
 
1476
- /**
1477
- * !!! This is an undocumented "private" function !!!
1478
- * @param {JQLite|Element} node
1479
- * @returns
1480
- */
1481
- JQLite._data = (node) => JQLite.cache.get(node[EXPANDO]) || {};
1482
-
1483
1483
  function jqNextId() {
1484
1484
  return ++jqId;
1485
1485
  }
@@ -1565,13 +1565,6 @@
1565
1565
  }
1566
1566
  }
1567
1567
 
1568
- function jqLiteHasData(node) {
1569
- for (const key in JQLite.cache.get(node[EXPANDO])) {
1570
- return true;
1571
- }
1572
- return false;
1573
- }
1574
-
1575
1568
  function jqLiteBuildFragment(html, context) {
1576
1569
  let tmp;
1577
1570
  let tag;
@@ -1671,6 +1664,11 @@
1671
1664
  }
1672
1665
  var jqLite = JQLite;
1673
1666
 
1667
+ /**
1668
+ * @param {Element} element
1669
+ * @param {boolean} [onlyDescendants]
1670
+ * @returns {void}
1671
+ */
1674
1672
  function dealoc(element, onlyDescendants) {
1675
1673
  if (!element) return;
1676
1674
  if (!onlyDescendants && elementAcceptsData(element))
@@ -1689,13 +1687,13 @@
1689
1687
  */
1690
1688
  function removeIfEmptyData(element) {
1691
1689
  const expandoId = element[EXPANDO];
1692
- const { events, data } = JQLite.cache.get(expandoId);
1690
+ const { events, data } = CACHE.get(expandoId);
1693
1691
 
1694
1692
  if (
1695
1693
  (!data || !Object.keys(data).length) &&
1696
1694
  (!events || !Object.keys(events).length)
1697
1695
  ) {
1698
- JQLite.cache.delete(expandoId);
1696
+ CACHE.delete(expandoId);
1699
1697
  element[EXPANDO] = undefined; // don't delete DOM expandos. IE and Chrome don't like it
1700
1698
  }
1701
1699
  }
@@ -1723,8 +1721,8 @@
1723
1721
  } else {
1724
1722
  const removeHandler = function (type) {
1725
1723
  const listenerFns = events[type];
1726
- if (isDefined(fn)) {
1727
- arrayRemove(listenerFns || [], fn);
1724
+ if (isDefined(fn) && isArray(listenerFns)) {
1725
+ arrayRemove(listenerFns, fn);
1728
1726
  }
1729
1727
  if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
1730
1728
  element.removeEventListener(type, handle);
@@ -1752,7 +1750,7 @@
1752
1750
  */
1753
1751
  function jqLiteRemoveData(element, name) {
1754
1752
  const expandoId = element[EXPANDO];
1755
- const expandoStore = expandoId && JQLite.cache.get(expandoId);
1753
+ const expandoStore = expandoId && CACHE.get(expandoId);
1756
1754
 
1757
1755
  if (expandoStore) {
1758
1756
  if (name) {
@@ -1773,7 +1771,7 @@
1773
1771
  */
1774
1772
  function jqLiteExpandoStore(element, createIfNecessary = false) {
1775
1773
  let expandoId = element[EXPANDO];
1776
- let expandoStore = expandoId && JQLite.cache.get(expandoId);
1774
+ let expandoStore = expandoId && CACHE.get(expandoId);
1777
1775
 
1778
1776
  if (createIfNecessary && !expandoStore) {
1779
1777
  element[EXPANDO] = expandoId = jqNextId();
@@ -1782,7 +1780,7 @@
1782
1780
  data: {},
1783
1781
  handle: null,
1784
1782
  };
1785
- JQLite.cache.set(expandoId, expandoStore);
1783
+ CACHE.set(expandoId, expandoStore);
1786
1784
  }
1787
1785
 
1788
1786
  return expandoStore;
@@ -1799,15 +1797,12 @@
1799
1797
  const data = expandoStore && expandoStore.data;
1800
1798
 
1801
1799
  if (isSimpleSetter) {
1802
- // data('key', value)
1803
1800
  data[kebabToCamel(key)] = value;
1804
1801
  } else {
1805
1802
  if (massGetter) {
1806
- // data()
1807
1803
  return data;
1808
1804
  }
1809
1805
  if (isSimpleGetter) {
1810
- // data('key')
1811
1806
  // don't force creation of expandoStore if it doesn't exist yet
1812
1807
  return data && data[kebabToCamel(key)];
1813
1808
  }
@@ -1954,7 +1949,7 @@
1954
1949
 
1955
1950
  function jqLiteCleanData(nodes) {
1956
1951
  for (let i = 0, ii = nodes.length; i < ii; i++) {
1957
- var events = (jqLite._data(nodes[i]) || {}).events;
1952
+ var events = (CACHE.get(nodes[i][EXPANDO]) || {}).events;
1958
1953
  if (events && events.$destroy) {
1959
1954
  jqLite(nodes[i]).triggerHandler("$destroy");
1960
1955
  }
@@ -1967,7 +1962,6 @@
1967
1962
  {
1968
1963
  data: jqLiteData,
1969
1964
  removeData: jqLiteRemoveData,
1970
- hasData: jqLiteHasData,
1971
1965
  cleanData: jqLiteCleanData,
1972
1966
  },
1973
1967
  (fn, name) => {
@@ -2090,8 +2084,6 @@
2090
2084
  let key;
2091
2085
  const nodeCount = this.length;
2092
2086
 
2093
- // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
2094
- // in a way that survives minification.
2095
2087
  // jqLiteEmpty takes no arguments but is a setter.
2096
2088
  if (
2097
2089
  fn !== jqLiteEmpty &&
@@ -2101,7 +2093,6 @@
2101
2093
  // we are a write, but the object properties are the key/values
2102
2094
  for (i = 0; i < nodeCount; i++) {
2103
2095
  if (fn === jqLiteData) {
2104
- // data() takes the whole object in jQuery
2105
2096
  fn(this[i], arg1);
2106
2097
  } else {
2107
2098
  for (key in arg1) {
@@ -9644,7 +9635,7 @@
9644
9635
  fragment.appendChild(elementsToRemove[i]);
9645
9636
  }
9646
9637
 
9647
- if (jqLite.hasData(firstElementToRemove)) {
9638
+ if (CACHE.has(firstElementToRemove[EXPANDO])) {
9648
9639
  // Copy over user data (that includes AngularJS's $scope etc.). Don't copy private
9649
9640
  // data here because there's no public interface in jQuery to do that and copying over
9650
9641
  // event listeners (which is the main use of private data) wouldn't work anyway.
@@ -16744,66 +16735,6 @@
16744
16735
  };
16745
16736
  }
16746
16737
 
16747
- /**
16748
- * @ngdoc directive
16749
- * @name ngSwitch
16750
- * @restrict EA
16751
- *
16752
- * @description
16753
- * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
16754
- * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
16755
- * as specified in the template.
16756
- *
16757
- * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
16758
- * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
16759
- * matches the value obtained from the evaluated expression. In other words, you define a container element
16760
- * (where you place the directive), place an expression on the **`on="..."` attribute**
16761
- * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
16762
- * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
16763
- * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
16764
- * attribute is displayed.
16765
- *
16766
- * <div class="alert alert-info">
16767
- * Be aware that the attribute values to match against cannot be expressions. They are interpreted
16768
- * as literal string values to match against.
16769
- * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
16770
- * value of the expression `$scope.someVal`.
16771
- * </div>
16772
-
16773
- * @animations
16774
- * | Animation | Occurs |
16775
- * |----------------------------------|-------------------------------------|
16776
- * | {@link ng.$animate#enter enter} | after the ngSwitch contents change and the matched child element is placed inside the container |
16777
- * | {@link ng.$animate#leave leave} | after the ngSwitch contents change and just before the former contents are removed from the DOM |
16778
- *
16779
- * @usage
16780
- *
16781
- * ```
16782
- * <ANY ng-switch="expression">
16783
- * <ANY ng-switch-when="matchValue1">...</ANY>
16784
- * <ANY ng-switch-when="matchValue2">...</ANY>
16785
- * <ANY ng-switch-default>...</ANY>
16786
- * </ANY>
16787
- * ```
16788
- *
16789
- *
16790
- * @scope
16791
- * @priority 1200
16792
- * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.
16793
- * On child elements add:
16794
- *
16795
- * * `ngSwitchWhen`: the case statement to match against. If match then this
16796
- * case will be displayed. If the same match appears multiple times, all the
16797
- * elements will be displayed. It is possible to associate multiple values to
16798
- * the same `ngSwitchWhen` by defining the optional attribute
16799
- * `ngSwitchWhenSeparator`. The separator will be used to split the value of
16800
- * the `ngSwitchWhen` attribute into multiple tokens, and the element will show
16801
- * if any of the `ngSwitch` evaluates to any of these tokens.
16802
- * * `ngSwitchDefault`: the default case when no other case match. If there
16803
- * are multiple default cases, all of them will be displayed when no other
16804
- * case match.
16805
- *
16806
- */
16807
16738
  const ngSwitchDirective = [
16808
16739
  "$animate",
16809
16740
  "$compile",
@@ -16813,11 +16744,13 @@
16813
16744
  // asks for $scope to fool the BC controller module
16814
16745
  controller: [
16815
16746
  "$scope",
16816
- function NgSwitchController() {
16817
- this.cases = {};
16747
+ class {
16748
+ constructor() {
16749
+ this.cases = {};
16750
+ }
16818
16751
  },
16819
16752
  ],
16820
- link(scope, element, attr, ngSwitchController) {
16753
+ link(scope, _element, attr, ngSwitchController) {
16821
16754
  const watchExpr = attr.ngSwitch || attr.on;
16822
16755
  let selectedTranscludes = [];
16823
16756
  const selectedElements = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "license": "MIT",
4
- "version": "0.0.2",
4
+ "version": "0.0.5",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.cjs.js",
7
7
  "module": "dist/angular-ts.esm.js",
@@ -40,8 +40,5 @@
40
40
  "sinon": "latest",
41
41
  "typescript": "latest",
42
42
  "vite": "latest"
43
- },
44
- "dependencies": {
45
-
46
43
  }
47
44
  }
@@ -0,0 +1 @@
1
+ These templates are used by express for various tests.
package/src/core/cache.js CHANGED
@@ -7,6 +7,8 @@
7
7
  *
8
8
  */
9
9
 
10
+ export const EXPANDO = "ngId";
11
+
10
12
  /**
11
13
  * Expando cache for adding properties to DOM nodes with JavaScript.
12
14
  * This used to be an Object in JQLite decorator, but swapped out for a Map
@@ -35,6 +35,7 @@ import {
35
35
  import { SCE_CONTEXTS } from "./sce";
36
36
  import { PREFIX_REGEXP, ALIASED_ATTR } from "../constants";
37
37
  import { createEventDirective } from "../directive/events";
38
+ import { CACHE, EXPANDO } from "./cache";
38
39
 
39
40
  const $compileMinErr = minErr("$compile");
40
41
 
@@ -3277,7 +3278,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
3277
3278
  fragment.appendChild(elementsToRemove[i]);
3278
3279
  }
3279
3280
 
3280
- if (jqLite.hasData(firstElementToRemove)) {
3281
+ if (CACHE.has(firstElementToRemove[EXPANDO])) {
3281
3282
  // Copy over user data (that includes AngularJS's $scope etc.). Don't copy private
3282
3283
  // data here because there's no public interface in jQuery to do that and copying over
3283
3284
  // event listeners (which is the main use of private data) wouldn't work anyway.
package/src/core/utils.js CHANGED
@@ -617,6 +617,14 @@ export function includes(array, obj) {
617
617
  return Array.prototype.indexOf.call(array, obj) !== -1;
618
618
  }
619
619
 
620
+ /**
621
+ * Removes the first occurrence of a specified value from an array.
622
+ *
623
+ * @template T
624
+ * @param {Array<T>} array - The array from which to remove the value.
625
+ * @param {T} value - The value to remove.
626
+ * @returns {number} - The index of the removed value, or -1 if the value was not found.
627
+ */
620
628
  export function arrayRemove(array, value) {
621
629
  const index = array.indexOf(value);
622
630
  if (index >= 0) {
@@ -39,12 +39,14 @@
39
39
  - ```
40
40
 
41
41
  ```
42
+
42
43
  - Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
43
44
  - script in the following Content Security Policy directive: "default-src 'self'". Note that
44
45
  - 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
45
46
  - ```
46
47
 
47
48
  ```
49
+
48
50
  -
49
51
  - This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
50
52
  - directive on an element of the HTML document that appears before the `<script>` tag that loads
@@ -1,66 +1,6 @@
1
1
  import { forEach } from "../core/utils";
2
2
  import { getBlockNodes } from "../jqLite";
3
3
 
4
- /**
5
- * @ngdoc directive
6
- * @name ngSwitch
7
- * @restrict EA
8
- *
9
- * @description
10
- * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
11
- * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
12
- * as specified in the template.
13
- *
14
- * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
15
- * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
16
- * matches the value obtained from the evaluated expression. In other words, you define a container element
17
- * (where you place the directive), place an expression on the **`on="..."` attribute**
18
- * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
19
- * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
20
- * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
21
- * attribute is displayed.
22
- *
23
- * <div class="alert alert-info">
24
- * Be aware that the attribute values to match against cannot be expressions. They are interpreted
25
- * as literal string values to match against.
26
- * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
27
- * value of the expression `$scope.someVal`.
28
- * </div>
29
-
30
- * @animations
31
- * | Animation | Occurs |
32
- * |----------------------------------|-------------------------------------|
33
- * | {@link ng.$animate#enter enter} | after the ngSwitch contents change and the matched child element is placed inside the container |
34
- * | {@link ng.$animate#leave leave} | after the ngSwitch contents change and just before the former contents are removed from the DOM |
35
- *
36
- * @usage
37
- *
38
- * ```
39
- * <ANY ng-switch="expression">
40
- * <ANY ng-switch-when="matchValue1">...</ANY>
41
- * <ANY ng-switch-when="matchValue2">...</ANY>
42
- * <ANY ng-switch-default>...</ANY>
43
- * </ANY>
44
- * ```
45
- *
46
- *
47
- * @scope
48
- * @priority 1200
49
- * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.
50
- * On child elements add:
51
- *
52
- * * `ngSwitchWhen`: the case statement to match against. If match then this
53
- * case will be displayed. If the same match appears multiple times, all the
54
- * elements will be displayed. It is possible to associate multiple values to
55
- * the same `ngSwitchWhen` by defining the optional attribute
56
- * `ngSwitchWhenSeparator`. The separator will be used to split the value of
57
- * the `ngSwitchWhen` attribute into multiple tokens, and the element will show
58
- * if any of the `ngSwitch` evaluates to any of these tokens.
59
- * * `ngSwitchDefault`: the default case when no other case match. If there
60
- * are multiple default cases, all of them will be displayed when no other
61
- * case match.
62
- *
63
- */
64
4
  export const ngSwitchDirective = [
65
5
  "$animate",
66
6
  "$compile",
@@ -70,11 +10,13 @@ export const ngSwitchDirective = [
70
10
  // asks for $scope to fool the BC controller module
71
11
  controller: [
72
12
  "$scope",
73
- function NgSwitchController() {
74
- this.cases = {};
13
+ class {
14
+ constructor() {
15
+ this.cases = {};
16
+ }
75
17
  },
76
18
  ],
77
- link(scope, element, attr, ngSwitchController) {
19
+ link(scope, _element, attr, ngSwitchController) {
78
20
  const watchExpr = attr.ngSwitch || attr.on;
79
21
  let selectedTranscludes = [];
80
22
  const selectedElements = [];
@@ -0,0 +1,66 @@
1
+ /\*\*
2
+
3
+ - @ngdoc directive
4
+ - @name ngSwitch
5
+ - @restrict EA
6
+ -
7
+ - @description
8
+ - The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
9
+ - Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
10
+ - as specified in the template.
11
+ -
12
+ - The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
13
+ - from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
14
+ - matches the value obtained from the evaluated expression. In other words, you define a container element
15
+ - (where you place the directive), place an expression on the **`on="..."` attribute**
16
+ - (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
17
+ - a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
18
+ - expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
19
+ - attribute is displayed.
20
+ -
21
+ - <div class="alert alert-info">
22
+ - Be aware that the attribute values to match against cannot be expressions. They are interpreted
23
+ - as literal string values to match against.
24
+ - For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
25
+ - value of the expression `$scope.someVal`.
26
+ - </div>
27
+
28
+ - @animations
29
+ - | Animation | Occurs |
30
+ - |----------------------------------|-------------------------------------|
31
+ - | {@link ng.$animate#enter enter} | after the ngSwitch contents change and the matched child element is placed inside the container |
32
+ - | {@link ng.$animate#leave leave} | after the ngSwitch contents change and just before the former contents are removed from the DOM |
33
+ -
34
+ - @usage
35
+ -
36
+ - ```
37
+
38
+ ```
39
+
40
+ - <ANY ng-switch="expression">
41
+ - <ANY ng-switch-when="matchValue1">...</ANY>
42
+ - <ANY ng-switch-when="matchValue2">...</ANY>
43
+ - <ANY ng-switch-default>...</ANY>
44
+ - </ANY>
45
+ - ```
46
+
47
+ ```
48
+
49
+ -
50
+ -
51
+ - @scope
52
+ - @priority 1200
53
+ - @param {\*} ngSwitch|on expression to match against <code>ng-switch-when</code>.
54
+ - On child elements add:
55
+ -
56
+ - - `ngSwitchWhen`: the case statement to match against. If match then this
57
+ - case will be displayed. If the same match appears multiple times, all the
58
+ - elements will be displayed. It is possible to associate multiple values to
59
+ - the same `ngSwitchWhen` by defining the optional attribute
60
+ - `ngSwitchWhenSeparator`. The separator will be used to split the value of
61
+ - the `ngSwitchWhen` attribute into multiple tokens, and the element will show
62
+ - if any of the `ngSwitch` evaluates to any of these tokens.
63
+ - - `ngSwitchDefault`: the default case when no other case match. If there
64
+ - are multiple default cases, all of them will be displayed when no other
65
+ - case match.
66
+ - \*/
package/src/jqLite.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  shallowCopy,
16
16
  trim,
17
17
  } from "./core/utils";
18
- import { CACHE } from "./core/cache";
18
+ import { CACHE, EXPANDO } from "./core/cache";
19
19
 
20
20
  /**
21
21
  * @ngdoc function
@@ -94,18 +94,8 @@ import { CACHE } from "./core/cache";
94
94
  * @returns {Object} jQuery object.
95
95
  */
96
96
 
97
- JQLite.cache = CACHE;
98
-
99
- const EXPANDO = "ngId";
100
97
  let jqId = 1;
101
98
 
102
- /**
103
- * !!! This is an undocumented "private" function !!!
104
- * @param {JQLite|Element} node
105
- * @returns
106
- */
107
- JQLite._data = (node) => JQLite.cache.get(node[EXPANDO]) || {};
108
-
109
99
  function jqNextId() {
110
100
  return ++jqId;
111
101
  }
@@ -191,13 +181,6 @@ function elementAcceptsData(node) {
191
181
  }
192
182
  }
193
183
 
194
- function jqLiteHasData(node) {
195
- for (const key in JQLite.cache.get(node[EXPANDO])) {
196
- return true;
197
- }
198
- return false;
199
- }
200
-
201
184
  export function jqLiteBuildFragment(html, context) {
202
185
  let tmp;
203
186
  let tag;
@@ -297,6 +280,11 @@ export function JQLite(element) {
297
280
  }
298
281
  export var jqLite = JQLite;
299
282
 
283
+ /**
284
+ * @param {Element} element
285
+ * @param {boolean} [onlyDescendants]
286
+ * @returns {void}
287
+ */
300
288
  export function dealoc(element, onlyDescendants) {
301
289
  if (!element) return;
302
290
  if (!onlyDescendants && elementAcceptsData(element))
@@ -315,13 +303,13 @@ export function dealoc(element, onlyDescendants) {
315
303
  */
316
304
  function removeIfEmptyData(element) {
317
305
  const expandoId = element[EXPANDO];
318
- const { events, data } = JQLite.cache.get(expandoId);
306
+ const { events, data } = CACHE.get(expandoId);
319
307
 
320
308
  if (
321
309
  (!data || !Object.keys(data).length) &&
322
310
  (!events || !Object.keys(events).length)
323
311
  ) {
324
- JQLite.cache.delete(expandoId);
312
+ CACHE.delete(expandoId);
325
313
  element[EXPANDO] = undefined; // don't delete DOM expandos. IE and Chrome don't like it
326
314
  }
327
315
  }
@@ -349,8 +337,8 @@ function jqLiteOff(element, type, fn, unsupported) {
349
337
  } else {
350
338
  const removeHandler = function (type) {
351
339
  const listenerFns = events[type];
352
- if (isDefined(fn)) {
353
- arrayRemove(listenerFns || [], fn);
340
+ if (isDefined(fn) && isArray(listenerFns)) {
341
+ arrayRemove(listenerFns, fn);
354
342
  }
355
343
  if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
356
344
  element.removeEventListener(type, handle);
@@ -378,7 +366,7 @@ function jqLiteOff(element, type, fn, unsupported) {
378
366
  */
379
367
  function jqLiteRemoveData(element, name) {
380
368
  const expandoId = element[EXPANDO];
381
- const expandoStore = expandoId && JQLite.cache.get(expandoId);
369
+ const expandoStore = expandoId && CACHE.get(expandoId);
382
370
 
383
371
  if (expandoStore) {
384
372
  if (name) {
@@ -399,7 +387,7 @@ function jqLiteRemoveData(element, name) {
399
387
  */
400
388
  function jqLiteExpandoStore(element, createIfNecessary = false) {
401
389
  let expandoId = element[EXPANDO];
402
- let expandoStore = expandoId && JQLite.cache.get(expandoId);
390
+ let expandoStore = expandoId && CACHE.get(expandoId);
403
391
 
404
392
  if (createIfNecessary && !expandoStore) {
405
393
  element[EXPANDO] = expandoId = jqNextId();
@@ -408,7 +396,7 @@ function jqLiteExpandoStore(element, createIfNecessary = false) {
408
396
  data: {},
409
397
  handle: null,
410
398
  };
411
- JQLite.cache.set(expandoId, expandoStore);
399
+ CACHE.set(expandoId, expandoStore);
412
400
  }
413
401
 
414
402
  return expandoStore;
@@ -425,15 +413,12 @@ function jqLiteData(element, key, value) {
425
413
  const data = expandoStore && expandoStore.data;
426
414
 
427
415
  if (isSimpleSetter) {
428
- // data('key', value)
429
416
  data[kebabToCamel(key)] = value;
430
417
  } else {
431
418
  if (massGetter) {
432
- // data()
433
419
  return data;
434
420
  }
435
421
  if (isSimpleGetter) {
436
- // data('key')
437
422
  // don't force creation of expandoStore if it doesn't exist yet
438
423
  return data && data[kebabToCamel(key)];
439
424
  }
@@ -580,7 +565,7 @@ export function getBooleanAttrName(element, name) {
580
565
 
581
566
  export function jqLiteCleanData(nodes) {
582
567
  for (let i = 0, ii = nodes.length; i < ii; i++) {
583
- var events = (jqLite._data(nodes[i]) || {}).events;
568
+ var events = (CACHE.get(nodes[i][EXPANDO]) || {}).events;
584
569
  if (events && events.$destroy) {
585
570
  jqLite(nodes[i]).triggerHandler("$destroy");
586
571
  }
@@ -593,7 +578,6 @@ forEach(
593
578
  {
594
579
  data: jqLiteData,
595
580
  removeData: jqLiteRemoveData,
596
- hasData: jqLiteHasData,
597
581
  cleanData: jqLiteCleanData,
598
582
  },
599
583
  (fn, name) => {
@@ -716,8 +700,6 @@ forEach(
716
700
  let key;
717
701
  const nodeCount = this.length;
718
702
 
719
- // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
720
- // in a way that survives minification.
721
703
  // jqLiteEmpty takes no arguments but is a setter.
722
704
  if (
723
705
  fn !== jqLiteEmpty &&
@@ -727,7 +709,6 @@ forEach(
727
709
  // we are a write, but the object properties are the key/values
728
710
  for (i = 0; i < nodeCount; i++) {
729
711
  if (fn === jqLiteData) {
730
- // data() takes the whole object in jQuery
731
712
  fn(this[i], arg1);
732
713
  } else {
733
714
  for (key in arg1) {