Skip to content

Commit f968e6b

Browse files
committed
fix v-pre end check for unary tags
1 parent ec7fca8 commit f968e6b

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/compiler/parser/index.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,25 @@ export function parse (
5252
transforms = pluckModuleFunction(options.modules, 'transformNode')
5353
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode')
5454
delimiters = options.delimiters
55+
5556
const stack = []
5657
const preserveWhitespace = options.preserveWhitespace !== false
5758
let root
5859
let currentParent
5960
let inVPre = false
6061
let inPre = false
6162
let warned = false
63+
64+
function endPre (element) {
65+
// check pre state
66+
if (element.pre) {
67+
inVPre = false
68+
}
69+
if (platformIsPreTag(element.tag)) {
70+
inPre = false
71+
}
72+
}
73+
6274
parseHTML(template, {
6375
expectHTML: options.expectHTML,
6476
isUnaryTag: options.isUnaryTag,
@@ -186,6 +198,8 @@ export function parse (
186198
if (!unary) {
187199
currentParent = element
188200
stack.push(element)
201+
} else {
202+
endPre(element)
189203
}
190204
// apply post-transforms
191205
for (let i = 0; i < postTransforms.length; i++) {
@@ -203,13 +217,7 @@ export function parse (
203217
// pop stack
204218
stack.length -= 1
205219
currentParent = stack[stack.length - 1]
206-
// check pre state
207-
if (element.pre) {
208-
inVPre = false
209-
}
210-
if (platformIsPreTag(element.tag)) {
211-
inPre = false
212-
}
220+
endPre(element)
213221
},
214222

215223
chars (text: string) {

0 commit comments

Comments
 (0)