Skip to content

since v2.3.0, in some specific cases, two consecutive comment vnodes will be merged into one text vnode. #5592

@maggiehe

Description

@maggiehe

Version

2.3.0

Reproduction link

https://jsfiddle.net/maggiehe/xovqtqd8/

Steps to reproduce

Use the following template with this.currentIndex = 1, then check this._vnode.

<div><div>foo</div><div v-for="i in 3" v-if="i===currentIndex" :key="i">{{i}}</div></div>

What is expected?

The template's childNodes will be compiled into: ["Element", "Element", "Comment", "Comment"]

What is actually happening?

Vue(>=2.3.0) compiles the template's childNodes into [ "Element", "Element", "Text" ], while Vue@2.2.6 performs correctly.


The bug will lead to this error: The client-side rendered virtual DOM tree is not matching server-rendered content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions