Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler-core): ignore empty siblings between v-if and v-else-if/else #1264

Closed
wants to merge 2 commits into from

Conversation

pikax
Copy link
Member

@pikax pikax commented May 29, 2020

fix #1256

Instead of using at the compiler parsing as in #1262, we ignore the whitespace elements when getting the siblings for vif

https://github.com/vuejs/vue-next/blob/master/packages/compiler-core/src/parse.ts#L203

EDIT:

<div id="app">
	<div />
	<!-- loading -->
	<div />

	Hello
</div>
import { createVNode as _createVNode, createTextVNode as _createTextVNode, openBlock as _openBlock, createBlock as _createBlock } from "vue"

export function render(_ctx, _cache) {
  return (_openBlock(), _createBlock("div", { id: "app" }, [
    _createVNode("div"),
    _createTextVNode(" " + " ", 1 /* TEXT */),
    _createVNode("div"),
    _createTextVNode(" Hello ")
  ]))
}

NOTE

_createTextVNode(" " + " ", 1 /* TEXT */), shouldn't be in the output, for not having it on the output #1262 does the job

@yyx990803
Copy link
Member

see f3623e4

@yyx990803 yyx990803 closed this Jun 11, 2020
@pikax pikax deleted the fix/comment_between_vif_and_velse branch June 11, 2020 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v-else fails on "prod" build when preceded by an HTML comment
2 participants