From a61f59479146c2d5e456d826100ce7ebbb87b99a Mon Sep 17 00:00:00 2001 From: Umang Galaiya Date: Sat, 13 Jul 2019 15:32:14 +0530 Subject: [PATCH] [Element][DOM] Set classDependencies before returning --- src/compile/render-dom/wrappers/Element/index.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compile/render-dom/wrappers/Element/index.ts b/src/compile/render-dom/wrappers/Element/index.ts index 290c1b0d6e..4609d95480 100644 --- a/src/compile/render-dom/wrappers/Element/index.ts +++ b/src/compile/render-dom/wrappers/Element/index.ts @@ -538,15 +538,19 @@ export default class ElementWrapper extends Wrapper { } addAttributes(block: Block) { + // Get all the class dependencies first + this.attributes.forEach((attribute: Attribute) => { + if (attribute.node.name === 'class' && attribute.node.isDynamic) { + this.classDependencies.push(...attribute.node.dependencies); + } + }); + if (this.node.attributes.find(attr => attr.type === 'Spread')) { this.addSpreadAttributes(block); return; } this.attributes.forEach((attribute: Attribute) => { - if (attribute.node.name === 'class' && attribute.node.isDynamic) { - this.classDependencies.push(...attribute.node.dependencies); - } attribute.render(block); }); } @@ -934,4 +938,4 @@ export default class ElementWrapper extends Wrapper { ); } } -} \ No newline at end of file +}