Skip to content

Commit 7b4400d

Browse files
committed
fix createElement ssr perf regression
1 parent 4a66c3d commit 7b4400d

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

src/core/vdom/create-element.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,27 @@ function _createElement (
4141
// in case of component :is set to falsy value
4242
return emptyVNode()
4343
}
44-
const Ctor = typeof tag === 'string'
45-
? resolveAsset(context.$options, 'components', tag)
46-
: tag
47-
if (Ctor) {
48-
return createComponent(Ctor, data, parent, context, host, children)
49-
} else if (typeof tag === 'string') {
50-
const ns = config.getTagNamespace(tag)
51-
return new VNode(
52-
tag, data, normalizeChildren(children, ns),
53-
undefined, undefined, ns, context, host
54-
)
44+
if (typeof tag === 'string') {
45+
let Ctor, ns
46+
if (config.isReservedTag(tag) || (ns = config.getTagNamespace(tag))) {
47+
// platform built-in elements
48+
return new VNode(
49+
tag, data, normalizeChildren(children, ns),
50+
undefined, undefined, ns, context, host
51+
)
52+
} else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
53+
// component
54+
return createComponent(Ctor, data, parent, context, host, children)
55+
} else {
56+
// unknown element, but check at runtime because it may get assigned
57+
// a namespace when its parent normalizes children
58+
return new VNode(
59+
tag, data, normalizeChildren(children),
60+
undefined, undefined, ns, context, host
61+
)
62+
}
63+
} else {
64+
// direct component options / constructor
65+
return createComponent(tag, data, parent, context, host, children)
5566
}
5667
}

0 commit comments

Comments
 (0)