(reactive: boolean, children: ComponentChildren)
| 1286 | } |
| 1287 | |
| 1288 | protected spawnChildren(reactive: boolean, children: ComponentChildren) { |
| 1289 | const parsedChildren = this.parseChildren(children); |
| 1290 | |
| 1291 | const keep = new Set<string>(); |
| 1292 | for (const newChild of parsedChildren) { |
| 1293 | const current = newChild.parent.context.raw() as Node | null; |
| 1294 | if (current && current !== this) { |
| 1295 | current.removeChild(newChild); |
| 1296 | } |
| 1297 | keep.add(newChild.key); |
| 1298 | newChild.parent(this); |
| 1299 | } |
| 1300 | |
| 1301 | for (const oldChild of this.realChildren) { |
| 1302 | if (!keep.has(oldChild.key)) { |
| 1303 | oldChild.parent(null); |
| 1304 | } |
| 1305 | } |
| 1306 | |
| 1307 | this.hasSpawnedChildren = reactive; |
| 1308 | this.realChildren = parsedChildren; |
| 1309 | } |
| 1310 | |
| 1311 | /** |
| 1312 | * Parse any `ComponentChildren` into an array of nodes. |
no test coverage detected