From c5ca0bd914b0e18c27d12d5c4dc81de18a90a1f8 Mon Sep 17 00:00:00 2001 From: Umang Galaiya Date: Sun, 14 Jul 2019 20:49:50 +0530 Subject: [PATCH] [Element][DOM] Set class dependencies before returning --- .../compile/render_dom/wrappers/Element/index.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts index 9b14d1cd6c..9d3f60ac7e 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/index.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts @@ -548,6 +548,13 @@ export default class ElementWrapper extends Wrapper { } add_attributes(block: Block) { + // Get all the class dependencies first + this.attributes.forEach((attribute) => { + if (attribute.node.name === 'class' && attribute.node.is_dynamic) { + this.class_dependencies.push(...attribute.node.dependencies); + } + }); + // @ts-ignore todo: if (this.node.attributes.find(attr => attr.type === 'Spread')) { this.add_spread_attributes(block); @@ -555,9 +562,6 @@ export default class ElementWrapper extends Wrapper { } this.attributes.forEach((attribute) => { - if (attribute.node.name === 'class' && attribute.node.is_dynamic) { - this.class_dependencies.push(...attribute.node.dependencies); - } attribute.render(block); }); }