@esportsplus/template 0.22.4 → 0.22.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.
@@ -13,20 +13,23 @@ function update(anchor, value) {
13
13
  if (value == null || value === false) {
14
14
  value = '';
15
15
  }
16
+ let textnode = this.textnode;
16
17
  if (typeof value !== 'object') {
17
- let textnode = this.textnode;
18
18
  if (textnode) {
19
19
  nodeValue.call(textnode, String(value));
20
+ if (!textnode.isConnected) {
21
+ anchor.after(textnode);
22
+ }
20
23
  }
21
24
  else {
22
- textnode = this.textnode = text(String(value));
23
- }
24
- if (!textnode.isConnected) {
25
- anchor.after(textnode);
25
+ anchor.after(this.textnode = text(String(value)));
26
26
  }
27
27
  }
28
28
  else {
29
29
  let fragment = render(anchor, value), head = firstChild.call(fragment);
30
+ if (textnode && textnode.isConnected) {
31
+ remove([{ head: textnode, tail: textnode }]);
32
+ }
30
33
  if (head) {
31
34
  this.group = {
32
35
  head,
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.4",
17
+ "version": "0.22.5",
18
18
  "scripts": {
19
19
  "build": "tsc && tsc-alias",
20
20
  "-": "-"
@@ -18,24 +18,28 @@ function update(this: { group?: SlotGroup, textnode?: Node }, anchor: Element, v
18
18
  value = '';
19
19
  }
20
20
 
21
- if (typeof value !== 'object') {
22
- let textnode = this.textnode;
21
+ let textnode = this.textnode;
23
22
 
23
+ if (typeof value !== 'object') {
24
24
  if (textnode) {
25
25
  nodeValue.call(textnode, String(value));
26
+
27
+ if (!textnode.isConnected) {
28
+ anchor.after(textnode);
29
+ }
26
30
  }
27
31
  else {
28
- textnode = this.textnode = text( String(value) );
29
- }
30
-
31
- if (!textnode.isConnected) {
32
- anchor.after(textnode);
32
+ anchor.after( this.textnode = text( String(value) ) );
33
33
  }
34
34
  }
35
35
  else {
36
36
  let fragment = render(anchor, value),
37
37
  head = firstChild.call(fragment);
38
38
 
39
+ if (textnode && textnode.isConnected) {
40
+ remove([{ head: textnode as Element, tail: textnode as Element }]);
41
+ }
42
+
39
43
  if (head) {
40
44
  this.group = {
41
45
  head,