diff --git a/src/compile/render-dom/wrappers/Element/index.ts b/src/compile/render-dom/wrappers/Element/index.ts index 290c1b0d6ee3..4609d9548024 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 +}