Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for mutiple class names as key #2585

Merged
merged 1 commit into from
Mar 31, 2016
Merged

Support for mutiple class names as key #2585

merged 1 commit into from
Mar 31, 2016

Conversation

phanan
Copy link
Member

@phanan phanan commented Mar 29, 2016

This is to replace #2581.

}
if (!obj[key]) continue

key.split(' ').forEach(function (k) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unconditional split + forEach can be slow, and class bindings can be a hot spot so performance is important.

Let's do an key.indexOf(' ') > 1 check first, then use a normal for loop. (And abstract this into a function)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what concerned me too, though I don't have an exact idea about the speed comparison between the check and a blind split.

This commit adds support for using multiple class names as key when
specifying a `:class` object, for example `<div :class="{ 'a b c': flag
}">`. Previously, doing so will trigger an uncaught
InvalidCharacterError, as spaces are not allowed in DOM tokens. Feature
request #2571 should also be satisfied by this commit.
@yyx990803 yyx990803 merged commit be7339b into vuejs:dev Mar 31, 2016
@phanan phanan deleted the multiple-class-names branch April 1, 2016 01:52
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.

None yet

2 participants