# HG changeset patch # User cin # Date 2021-09-01 23:43:20 # Node ID 16678c6055f20ce1a49bdca5e6dabce88ee8deed # Parent 8d7c7f8418be2455813ee7c02352967333aa1305 fixed tsx/traits.destroy to handle non-element dom nodes diff --git a/djx/src/main/ts/tsx/traits.ts b/djx/src/main/ts/tsx/traits.ts --- a/djx/src/main/ts/tsx/traits.ts +++ b/djx/src/main/ts/tsx/traits.ts @@ -110,9 +110,9 @@ export function destroy(target: Node | I } else if (isDestroyable(target)) { target.destroy(); } else if (isNode(target)) { - const self = registry.byNode(target); - if (self) { - self.destroyRecursive(); + const w = isElementNode(target) ? registry.byNode(target) : undefined; + if (w) { + w.destroyRecursive(); } else { registry.findWidgets(target).forEach(destroy); dom.destroy(target);