Skip to content

Conversation

xanf
Copy link
Contributor

@xanf xanf commented Oct 11, 2019

Current logic in vnode.ts does not normalize classes for templates, because of PatchFlags.CLASS set on compiled VNode.

Unfortunately, at least for browser build, PatchFlags.CLASS does not mean that any kind of compile-time optimization was applied to class (I'm not 100% sure, but it seems that it is handled by processExpression code path, which is not taken in a browser)

It results in [object Object] being displayed as a class name when :class = { foo: smthng, bar: smthng } syntax is used.

This PR removes that extra check and adds an integration test for this scenario.

@xanf xanf force-pushed the fix-class-object-syntax branch from c0c53ef to 1c8d24f Compare October 11, 2019 16:55
@yyx990803
Copy link
Member

Yeah, that's correct. I dropped the class optimization part because it relies on full AST analysis and won't be consistent between browser/non-browser builds.

@yyx990803 yyx990803 merged commit e32da91 into vuejs:master Oct 11, 2019
@vue-bot
Copy link
Contributor

vue-bot commented Oct 11, 2019

Hey @xanf, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚

sxzz added a commit that referenced this pull request Aug 12, 2024
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants