Skip to content

Commit dc00590

Browse files
committed
comments
1 parent ec70b44 commit dc00590

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,17 @@ function normalizeArrayChildren (children: any, nestedIndex?: string): Array<VNo
5252
res.push.apply(res, normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`))
5353
} else if (isPrimitive(c)) {
5454
if (isTextNode(last)) {
55+
// merge adjacent text nodes
56+
// this is necessary for SSR hydration because text nodes are
57+
// essentially merged when rendered to HTML strings
5558
(last: any).text += String(c)
5659
} else if (c !== '') {
5760
// convert primitive to vnode
5861
res.push(createTextVNode(c))
5962
}
6063
} else {
6164
if (isTextNode(c) && isTextNode(last)) {
65+
// merge adjacent text nodes
6266
res[res.length - 1] = createTextVNode(last.text + c.text)
6367
} else {
6468
// default key for nested array children (likely generated by v-for)

0 commit comments

Comments
 (0)