_createElement() — vue Function Reference
Architecture documentation for the _createElement() function in create-element.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 53f4baed_8a93_cc70_5c6b_47da31c500b5["_createElement()"] ed56e0c4_2667_3b26_6b70_35cd51b08810["create-element.ts"] 53f4baed_8a93_cc70_5c6b_47da31c500b5 -->|defined in| ed56e0c4_2667_3b26_6b70_35cd51b08810 2c55eb58_ce03_1c5e_ac99_4fc1ef41c3cd["createElement()"] 2c55eb58_ce03_1c5e_ac99_4fc1ef41c3cd -->|calls| 53f4baed_8a93_cc70_5c6b_47da31c500b5 31e5e118_7c5b_0045_7068_77862597abea["createEmptyVNode()"] 53f4baed_8a93_cc70_5c6b_47da31c500b5 -->|calls| 31e5e118_7c5b_0045_7068_77862597abea cd4ab087_1a92_967b_8b0c_652f9562b5f0["createComponent()"] 53f4baed_8a93_cc70_5c6b_47da31c500b5 -->|calls| cd4ab087_1a92_967b_8b0c_652f9562b5f0 f098fc10_4e3c_ef83_c409_c5651cff3161["applyNS()"] 53f4baed_8a93_cc70_5c6b_47da31c500b5 -->|calls| f098fc10_4e3c_ef83_c409_c5651cff3161 ae0f608e_8a6c_e22c_d51f_e2504ed3db4b["registerDeepBindings()"] 53f4baed_8a93_cc70_5c6b_47da31c500b5 -->|calls| ae0f608e_8a6c_e22c_d51f_e2504ed3db4b style 53f4baed_8a93_cc70_5c6b_47da31c500b5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/vdom/create-element.ts lines 46–140
export function _createElement(
context: Component,
tag?: string | Component | Function | Object,
data?: VNodeData,
children?: any,
normalizationType?: number
): VNode | Array<VNode> {
if (isDef(data) && isDef((data as any).__ob__)) {
__DEV__ &&
warn(
`Avoid using observed data object as vnode data: ${JSON.stringify(
data
)}\n` + 'Always create fresh vnode data objects in each render!',
context
)
return createEmptyVNode()
}
// object syntax in v-bind
if (isDef(data) && isDef(data.is)) {
tag = data.is
}
if (!tag) {
// in case of component :is set to falsy value
return createEmptyVNode()
}
// warn against non-primitive key
if (__DEV__ && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
warn(
'Avoid using non-primitive value as key, ' +
'use string/number value instead.',
context
)
}
// support single function children as default scoped slot
if (isArray(children) && isFunction(children[0])) {
data = data || {}
data.scopedSlots = { default: children[0] }
children.length = 0
}
if (normalizationType === ALWAYS_NORMALIZE) {
children = normalizeChildren(children)
} else if (normalizationType === SIMPLE_NORMALIZE) {
children = simpleNormalizeChildren(children)
}
let vnode, ns
if (typeof tag === 'string') {
let Ctor
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag)
if (config.isReservedTag(tag)) {
// platform built-in elements
if (
__DEV__ &&
isDef(data) &&
isDef(data.nativeOn) &&
data.tag !== 'component'
) {
warn(
`The .native modifier for v-on is only valid on components but it was used on <${tag}>.`,
context
)
}
vnode = new VNode(
config.parsePlatformTagName(tag),
data,
children,
undefined,
undefined,
context
)
} else if (
(!data || !data.pre) &&
isDef((Ctor = resolveAsset(context.$options, 'components', tag)))
) {
// component
vnode = createComponent(Ctor, data, context, children, tag)
} else {
// unknown or unlisted namespaced elements
// check at runtime because it may get assigned a namespace when its
// parent normalizes children
vnode = new VNode(tag, data, children, undefined, undefined, context)
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _createElement() do?
_createElement() is a function in the vue codebase, defined in src/core/vdom/create-element.ts.
Where is _createElement() defined?
_createElement() is defined in src/core/vdom/create-element.ts at line 46.
What does _createElement() call?
_createElement() calls 4 function(s): applyNS, createComponent, createEmptyVNode, registerDeepBindings.
What calls _createElement()?
_createElement() is called by 1 function(s): createElement.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free