@swiftwc/ui 0.0.0-dev.68 → 0.0.0-dev.69
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/generated/tpl/render.js +7 -11
- package/package.json +1 -1
package/generated/tpl/render.js
CHANGED
|
@@ -45,10 +45,7 @@ function createInstance(prepared) {
|
|
|
45
45
|
if (descriptorIndex >= descriptors.length)
|
|
46
46
|
break;
|
|
47
47
|
if (node.nodeType === Node.COMMENT_NODE && node.data === MARKER) {
|
|
48
|
-
|
|
49
|
-
const end = document.createComment(MARKER);
|
|
50
|
-
start.after(end);
|
|
51
|
-
parts.push({ type: 'child', start, end, committed: undefined });
|
|
48
|
+
parts.push({ type: 'child', anchor: node, nodes: [], committed: undefined });
|
|
52
49
|
descriptorIndex++;
|
|
53
50
|
}
|
|
54
51
|
else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -86,17 +83,16 @@ function toNode(value) {
|
|
|
86
83
|
function commitChild(part, value) {
|
|
87
84
|
if (value === part.committed)
|
|
88
85
|
return; // dirty-check, skip untouched parts
|
|
89
|
-
|
|
90
|
-
let n = part.start.nextSibling;
|
|
91
|
-
while (n && n !== part.end) {
|
|
92
|
-
const next = n.nextSibling;
|
|
86
|
+
for (const n of part.nodes)
|
|
93
87
|
n.remove();
|
|
94
|
-
|
|
95
|
-
}
|
|
88
|
+
const nodes = [];
|
|
96
89
|
for (const item of Array.isArray(value) ? value : [value]) {
|
|
97
90
|
if (item === null || item === undefined || item === false)
|
|
98
91
|
continue;
|
|
99
|
-
|
|
92
|
+
const node = toNode(item);
|
|
93
|
+
const inserted = node instanceof DocumentFragment ? Array.from(node.childNodes) : [node];
|
|
94
|
+
part.anchor.before(node);
|
|
95
|
+
nodes.push(...inserted);
|
|
100
96
|
}
|
|
101
97
|
part.committed = value;
|
|
102
98
|
}
|