| 1456 | // A bound child's old placement may hold only a placeholder while its nodes await a move, |
| 1457 | // and the container may hold nodes the renderer did not place. Clearing it would detach them. |
| 1458 | const removeAll = (inst: Instance, parent: unknown, olds: ReadonlyArray<Rec>): void => { |
| 1459 | const host = inst.tree.host |
| 1460 | const from = boundReleases |
| 1461 | const nodes: Array<unknown> = [] |
| 1462 | for (let index = 0; index < olds.length; index++) { |
| 1463 | release(inst, olds[index]!) |
| 1464 | nodesOf(olds[index]!, nodes) |
| 1465 | } |
| 1466 | if (host.clear === undefined || boundReleases !== from || !host.clear(parent, nodes.length)) { |
| 1467 | for (const node of nodes) host.remove(parent, node) |
| 1468 | } |
| 1469 | } |
| 1470 | |
| 1471 | /** @internal */ |
| 1472 | export const nodesOf = (rec: Rec, out: Array<unknown>): Array<unknown> => { |