diff --git a/src/core/vdom/create-element.ts b/src/core/vdom/create-element.ts index bad54d97fa0..6abade56757 100644 --- a/src/core/vdom/create-element.ts +++ b/src/core/vdom/create-element.ts @@ -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')) @@ -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