@esportsplus/template 0.22.2 → 0.22.4

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.
@@ -26,7 +26,7 @@ const NODE_WHITELIST = {
26
26
  'track': NODE_VOID,
27
27
  'wbr': NODE_VOID
28
28
  };
29
- const REGEX_EMPTY_TEXT_NODES = /(>|}|)\s+(<|{|\s)/g;
29
+ const REGEX_EMPTY_TEXT_NODES = /(>|}|\s)\s+(<|{|\s)/g;
30
30
  const REGEX_EVENTS = /(?:\s*on[\w-:]+\s*=(?:\s*["'][^"']*["'])*)/g;
31
31
  const REGEX_SLOT_ATTRIBUTES = /<[\w-]+([^><]*{{\$}}[^><]*)>/g;
32
32
  const REGEX_SLOT_NODES = /<([\w-]+|[\/!])(?:([^><]*{{\$}}[^><]*)|(?:[^><]*))?>|{{\$}}/g;
@@ -31,18 +31,19 @@ const ondisconnect = (element, fn) => {
31
31
  (element[CLEANUP] ??= []).push(fn);
32
32
  };
33
33
  const remove = (groups) => {
34
- let group, head, tail;
34
+ let group;
35
35
  while (group = groups.pop()) {
36
- head = group.head;
37
- tail = group.tail || head;
38
- for (let node = tail; node; node = previousSibling.call(node)) {
39
- if (CLEANUP in node) {
40
- cleanup.add(node[CLEANUP]);
36
+ let head = group.head, next, tail = group.tail || head;
37
+ while (tail) {
38
+ if (CLEANUP in tail) {
39
+ cleanup.add(tail[CLEANUP]);
41
40
  }
42
- node.remove();
43
- if (head === node) {
41
+ next = previousSibling.call(tail);
42
+ tail.remove();
43
+ if (head === tail) {
44
44
  break;
45
45
  }
46
+ tail = next;
46
47
  }
47
48
  }
48
49
  if (!scheduled && cleanup.length) {
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "private": false,
15
15
  "type": "module",
16
16
  "types": "./build/index.d.ts",
17
- "version": "0.22.2",
17
+ "version": "0.22.4",
18
18
  "scripts": {
19
19
  "build": "tsc && tsc-alias",
20
20
  "-": "-"
package/src/constants.ts CHANGED
@@ -40,7 +40,7 @@ const NODE_WHITELIST: Record<string, number> = {
40
40
  };
41
41
 
42
42
 
43
- const REGEX_EMPTY_TEXT_NODES = /(>|}|)\s+(<|{|\s)/g;
43
+ const REGEX_EMPTY_TEXT_NODES = /(>|}|\s)\s+(<|{|\s)/g;
44
44
 
45
45
  const REGEX_EVENTS = /(?:\s*on[\w-:]+\s*=(?:\s*["'][^"']*["'])*)/g;
46
46
 
@@ -45,22 +45,26 @@ const ondisconnect = (element: Element, fn: VoidFunction) => {
45
45
  };
46
46
 
47
47
  const remove = (groups: SlotGroup[]) => {
48
- let group, head, tail;
48
+ let group;
49
49
 
50
50
  while (group = groups.pop()) {
51
- head = group.head;
52
- tail = group.tail || head;
51
+ let head = group.head,
52
+ next,
53
+ tail = group.tail || head;
53
54
 
54
- for (let node = tail; node; node = previousSibling.call(node)) {
55
- if (CLEANUP in node) {
56
- cleanup.add( node[CLEANUP] as VoidFunction[] );
55
+ while (tail) {
56
+ if (CLEANUP in tail) {
57
+ cleanup.add( tail[CLEANUP] as VoidFunction[] );
57
58
  }
58
59
 
59
- node.remove();
60
+ next = previousSibling.call(tail);
61
+ tail.remove();
60
62
 
61
- if (head === node) {
63
+ if (head === tail) {
62
64
  break;
63
65
  }
66
+
67
+ tail = next;
64
68
  }
65
69
  }
66
70