From: Evan You Date: Sun, 28 Oct 2018 18:22:52 +0000 (-0400) Subject: fix: fragment replaceVNode X-Git-Tag: v3.0.0-alpha.0~1070 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8dd725e41e636f60426d072557034bbad2a6d84;p=thirdparty%2Fvuejs%2Fcore.git fix: fragment replaceVNode --- diff --git a/packages/runtime-core/__tests__/fragment.spec.ts b/packages/runtime-core/__tests__/fragment.spec.ts index 17488df56c..e558a74178 100644 --- a/packages/runtime-core/__tests__/fragment.spec.ts +++ b/packages/runtime-core/__tests__/fragment.spec.ts @@ -80,7 +80,7 @@ describe('Fragments', () => { render() { return state.ok ? [h('div', 'one'), 'two'] - : [h('div', 'foo'), 'bar', 'baz'] + : [h('pre', 'foo'), 'bar', 'baz'] } } const root = nodeOps.createElement('div') @@ -90,7 +90,7 @@ describe('Fragments', () => { state.ok = false await nextTick() - expect(serialize(root)).toBe(`
foo
barbaz
`) + expect(serialize(root)).toBe(`
foo
barbaz
`) }) it('should be able to patch fragment children (explcitly keyed)', async () => { diff --git a/packages/runtime-core/src/createRenderer.ts b/packages/runtime-core/src/createRenderer.ts index 9e90371b33..354450d959 100644 --- a/packages/runtime-core/src/createRenderer.ts +++ b/packages/runtime-core/src/createRenderer.ts @@ -164,14 +164,14 @@ export function createRenderer(options: RendererOptions) { if (childFlags !== ChildrenFlags.NO_CHILDREN) { const hasSVGChildren = isSVG && tag !== 'foreignObject' if (childFlags & ChildrenFlags.SINGLE_VNODE) { - mount(children as VNode, el, contextVNode, hasSVGChildren, endNode) + mount(children as VNode, el, contextVNode, hasSVGChildren, null) } else if (childFlags & ChildrenFlags.MULTIPLE_VNODES) { mountArrayChildren( children as VNode[], el, contextVNode, hasSVGChildren, - endNode + null ) } }