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

fix #5592: comment vnode should not be merged into text vnode. #5593

Merged
merged 3 commits into from May 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/vdom/helpers/normalize-children.js
@@ -1,7 +1,7 @@
/* @flow */

import VNode, { createTextVNode } from 'core/vdom/vnode'
import { isDef, isUndef, isPrimitive } from 'shared/util'
import { isFalse, isDef, isUndef, isPrimitive } from 'shared/util'

// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
Expand Down Expand Up @@ -54,7 +54,7 @@ function normalizeArrayChildren (children: any, nestedIndex?: string): Array<VNo
res.push(createTextVNode(c))
}
} else {
if (isDef(c.text) && isDef(last) && isDef(last.text)) {
if (isFalse(c.isComment) && isDef(c.text) && isDef(last) && isFalse(last.isComment) && isDef(last.text)) {
res[res.length - 1] = createTextVNode(last.text + c.text)
} else {
// default key for nested array children (likely generated by v-for)
Expand Down
3 changes: 3 additions & 0 deletions src/shared/util.js
Expand Up @@ -14,6 +14,9 @@ export function isTrue (v: any): boolean %checks {
return v === true
}

export function isFalse (v: any): boolean %checks {
return v === false
}
/**
* Check if value is primitive
*/
Expand Down