Skip to content

Commit a8da4fb

Browse files
maggieheyyx990803
authored andcommitted
fix vuejs#5592: comment vnode should not be merged into text vnode. (vuejs#5593)
* comment vnode should not be merged into text vnode. * add isFalse helper * delete trailing spaces
1 parent b977c77 commit a8da4fb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/core/vdom/helpers/normalize-children.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @flow */
22

33
import VNode, { createTextVNode } from 'core/vdom/vnode'
4-
import { isDef, isUndef, isPrimitive } from 'shared/util'
4+
import { isFalse, isDef, isUndef, isPrimitive } from 'shared/util'
55

66
// The template compiler attempts to minimize the need for normalization by
77
// statically analyzing the template at compile time.
@@ -54,7 +54,7 @@ function normalizeArrayChildren (children: any, nestedIndex?: string): Array<VNo
5454
res.push(createTextVNode(c))
5555
}
5656
} else {
57-
if (isDef(c.text) && isDef(last) && isDef(last.text)) {
57+
if (isFalse(c.isComment) && isDef(c.text) && isDef(last) && isFalse(last.isComment) && isDef(last.text)) {
5858
res[res.length - 1] = createTextVNode(last.text + c.text)
5959
} else {
6060
// default key for nested array children (likely generated by v-for)

src/shared/util.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export function isTrue (v: any): boolean %checks {
1414
return v === true
1515
}
1616

17+
export function isFalse (v: any): boolean %checks {
18+
return v === false
19+
}
1720
/**
1821
* Check if value is primitive
1922
*/

0 commit comments

Comments
 (0)