fix: fragment replaceVNode

This commit is contained in:
Evan You 2018-10-28 14:22:52 -04:00
parent 45e9a42a1a
commit e8dd725e41
2 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,7 @@ describe('Fragments', () => {
render() { render() {
return state.ok return state.ok
? [h('div', 'one'), 'two'] ? [h('div', 'one'), 'two']
: [h('div', 'foo'), 'bar', 'baz'] : [h('pre', 'foo'), 'bar', 'baz']
} }
} }
const root = nodeOps.createElement('div') const root = nodeOps.createElement('div')
@ -90,7 +90,7 @@ describe('Fragments', () => {
state.ok = false state.ok = false
await nextTick() 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 () => { it('should be able to patch fragment children (explcitly keyed)', async () => {

View File

@ -164,14 +164,14 @@ export function createRenderer(options: RendererOptions) {
if (childFlags !== ChildrenFlags.NO_CHILDREN) { if (childFlags !== ChildrenFlags.NO_CHILDREN) {
const hasSVGChildren = isSVG && tag !== 'foreignObject' const hasSVGChildren = isSVG && tag !== 'foreignObject'
if (childFlags & ChildrenFlags.SINGLE_VNODE) { 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) { } else if (childFlags & ChildrenFlags.MULTIPLE_VNODES) {
mountArrayChildren( mountArrayChildren(
children as VNode[], children as VNode[],
el, el,
contextVNode, contextVNode,
hasSVGChildren, hasSVGChildren,
endNode null
) )
} }
} }