Skip to content

Commit

Permalink
refactor: extract variable
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhonghe committed Apr 24, 2023
1 parent 904cd6d commit 9bc9025
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/core/vdom/create-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,14 @@ function applyNS(vnode, ns, force?: boolean) {
ns = undefined
force = true
}
if (isDef(vnode.children)) {
for (let i = 0, l = vnode.children.length; i < l; i++) {
const child = vnode.children[i]
const children =
vnode.children ||
// #11315
(vnode.componentOptions && vnode.componentOptions.children)

if (isDef(children)) {
for (let i = 0, l = children.length; i < l; i++) {
const child = children[i]
if (
isDef(child.tag) &&
(isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))
Expand All @@ -157,17 +162,6 @@ function applyNS(vnode, ns, force?: boolean) {
}
}
}

// #11315
if (isObject(vnode.componentOptions) && isDef(vnode.componentOptions.children)) {
for (var i = 0, l = vnode.componentOptions.children.length; i < l; i++) {
var child = vnode.componentOptions.children[i]
if (isDef(child.tag) && (
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
applyNS(child, ns, force)
}
}
}
}

// ref #5318
Expand Down

0 comments on commit 9bc9025

Please sign in to comment.