diff --git a/glass-easel/src/element.ts b/glass-easel/src/element.ts index 9438c19..941bfe6 100644 --- a/glass-easel/src/element.ts +++ b/glass-easel/src/element.ts @@ -405,6 +405,9 @@ export class Element implements NodeCast { private static checkAndCallDetached(node: Node) { const callFunc = function callFunc(node: Node) { + if (node._$destroyOnDetach) { + node.destroyBackendElement() + } if (node instanceof Element && node._$attached) { node.childNodes.forEach(callFunc) if (node instanceof Component) { @@ -430,9 +433,6 @@ export class Element implements NodeCast { node._$attached = false } } - if (node._$destroyOnDetach) { - node.destroyBackendElement() - } } callFunc(node) }