normalizeArrayChildren() — vue Function Reference
Architecture documentation for the normalizeArrayChildren() function in normalize-children.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 0c8ebe49_d09f_6359_f9ed_6fe0453004a9["normalizeArrayChildren()"] d69da2e1_41ea_0fe7_418f_f2b93ff8744d["normalize-children.ts"] 0c8ebe49_d09f_6359_f9ed_6fe0453004a9 -->|defined in| d69da2e1_41ea_0fe7_418f_f2b93ff8744d 525c172b_db5f_072d_3b30_fb5ba93487bb["normalizeChildren()"] 525c172b_db5f_072d_3b30_fb5ba93487bb -->|calls| 0c8ebe49_d09f_6359_f9ed_6fe0453004a9 219e7938_652b_4072_438b_1bd76b721449["isTextNode()"] 0c8ebe49_d09f_6359_f9ed_6fe0453004a9 -->|calls| 219e7938_652b_4072_438b_1bd76b721449 style 0c8ebe49_d09f_6359_f9ed_6fe0453004a9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/vdom/helpers/normalize-children.ts lines 48–99
function normalizeArrayChildren(
children: any,
nestedIndex?: string
): Array<VNode> {
const res: VNode[] = []
let i, c, lastIndex, last
for (i = 0; i < children.length; i++) {
c = children[i]
if (isUndef(c) || typeof c === 'boolean') continue
lastIndex = res.length - 1
last = res[lastIndex]
// nested
if (isArray(c)) {
if (c.length > 0) {
c = normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`)
// merge adjacent text nodes
if (isTextNode(c[0]) && isTextNode(last)) {
res[lastIndex] = createTextVNode(last.text + c[0].text)
c.shift()
}
res.push.apply(res, c)
}
} else if (isPrimitive(c)) {
if (isTextNode(last)) {
// merge adjacent text nodes
// this is necessary for SSR hydration because text nodes are
// essentially merged when rendered to HTML strings
res[lastIndex] = createTextVNode(last.text + c)
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c))
}
} else {
if (isTextNode(c) && isTextNode(last)) {
// merge adjacent text nodes
res[lastIndex] = createTextVNode(last.text + c.text)
} else {
// default key for nested array children (likely generated by v-for)
if (
isTrue(children._isVList) &&
isDef(c.tag) &&
isUndef(c.key) &&
isDef(nestedIndex)
) {
c.key = `__vlist${nestedIndex}_${i}__`
}
res.push(c)
}
}
}
return res
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does normalizeArrayChildren() do?
normalizeArrayChildren() is a function in the vue codebase, defined in src/core/vdom/helpers/normalize-children.ts.
Where is normalizeArrayChildren() defined?
normalizeArrayChildren() is defined in src/core/vdom/helpers/normalize-children.ts at line 48.
What does normalizeArrayChildren() call?
normalizeArrayChildren() calls 1 function(s): isTextNode.
What calls normalizeArrayChildren()?
normalizeArrayChildren() is called by 1 function(s): normalizeChildren.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free