]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: fragment replaceVNode
authorEvan You <yyx990803@gmail.com>
Sun, 28 Oct 2018 18:22:52 +0000 (14:22 -0400)
committerEvan You <yyx990803@gmail.com>
Sun, 28 Oct 2018 18:22:52 +0000 (14:22 -0400)
packages/runtime-core/__tests__/fragment.spec.ts
packages/runtime-core/src/createRenderer.ts

index 17488df56ccd91505b112eb41d25fc6eee989c33..e558a74178eaf9de50030eca14c95739f5562041 100644 (file)
@@ -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(`<div><div>foo</div>barbaz</div>`)
+    expect(serialize(root)).toBe(`<div><pre>foo</pre>barbaz</div>`)
   })
 
   it('should be able to patch fragment children (explcitly keyed)', async () => {
index 9e90371b333934352b7bbea9c3d6a29a5a62ed3f..354450d959099a65c53eb77375b11362337311e6 100644 (file)
@@ -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
         )
       }
     }