|
@@ -36,6 +36,10 @@ export function normalizeChildren (children: any): ?Array<VNode> {
|
|
|
: undefined
|
|
: undefined
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function isTextNode (node): boolean {
|
|
|
|
|
+ return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function normalizeArrayChildren (children: any, nestedIndex?: string): Array<VNode> {
|
|
function normalizeArrayChildren (children: any, nestedIndex?: string): Array<VNode> {
|
|
|
const res = []
|
|
const res = []
|
|
|
let i, c, last
|
|
let i, c, last
|
|
@@ -47,14 +51,14 @@ function normalizeArrayChildren (children: any, nestedIndex?: string): Array<VNo
|
|
|
if (Array.isArray(c)) {
|
|
if (Array.isArray(c)) {
|
|
|
res.push.apply(res, normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`))
|
|
res.push.apply(res, normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`))
|
|
|
} else if (isPrimitive(c)) {
|
|
} else if (isPrimitive(c)) {
|
|
|
- if (isDef(last) && isDef(last.text)) {
|
|
|
|
|
- last.text += String(c)
|
|
|
|
|
|
|
+ if (isTextNode(last)) {
|
|
|
|
|
+ (last: any).text += String(c)
|
|
|
} else if (c !== '') {
|
|
} else if (c !== '') {
|
|
|
// convert primitive to vnode
|
|
// convert primitive to vnode
|
|
|
res.push(createTextVNode(c))
|
|
res.push(createTextVNode(c))
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- if (isFalse(c.isComment) && isDef(c.text) && isDef(last) && isFalse(last.isComment) && isDef(last.text)) {
|
|
|
|
|
|
|
+ if (isTextNode(c) && isTextNode(last)) {
|
|
|
res[res.length - 1] = createTextVNode(last.text + c.text)
|
|
res[res.length - 1] = createTextVNode(last.text + c.text)
|
|
|
} else {
|
|
} else {
|
|
|
// default key for nested array children (likely generated by v-for)
|
|
// default key for nested array children (likely generated by v-for)
|