Skip to content

Commit 9bc9025

Browse files
committed
refactor: extract variable
1 parent 904cd6d commit 9bc9025

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/core/vdom/create-element.ts

+8-14
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,14 @@ function applyNS(vnode, ns, force?: boolean) {
146146
ns = undefined
147147
force = true
148148
}
149-
if (isDef(vnode.children)) {
150-
for (let i = 0, l = vnode.children.length; i < l; i++) {
151-
const child = vnode.children[i]
149+
const children =
150+
vnode.children ||
151+
// #11315
152+
(vnode.componentOptions && vnode.componentOptions.children)
153+
154+
if (isDef(children)) {
155+
for (let i = 0, l = children.length; i < l; i++) {
156+
const child = children[i]
152157
if (
153158
isDef(child.tag) &&
154159
(isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))
@@ -157,17 +162,6 @@ function applyNS(vnode, ns, force?: boolean) {
157162
}
158163
}
159164
}
160-
161-
// #11315
162-
if (isObject(vnode.componentOptions) && isDef(vnode.componentOptions.children)) {
163-
for (var i = 0, l = vnode.componentOptions.children.length; i < l; i++) {
164-
var child = vnode.componentOptions.children[i]
165-
if (isDef(child.tag) && (
166-
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
167-
applyNS(child, ns, force)
168-
}
169-
}
170-
}
171165
}
172166

173167
// ref #5318

0 commit comments

Comments
 (0)