Skip to content

Commit

Permalink
fix(compiler-core): properly exit self-closing pre tag
Browse files Browse the repository at this point in the history
fix #4030
  • Loading branch information
yyx990803 committed Jul 1, 2021
1 parent 127ed1b commit d2df28d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/compiler-core/src/parse.ts
Expand Up @@ -425,6 +425,10 @@ function parseElement(
const isVPreBoundary = context.inVPre && !wasInVPre

if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
// #4030 self-closing <pre> tag
if (context.options.isPreTag(element.tag)) {
context.inPre = false
}
return element
}

Expand Down Expand Up @@ -528,14 +532,15 @@ function parseTag(
const cursor = getCursor(context)
const currentSource = context.source

// Attributes.
let props = parseAttributes(context, type)

// check <pre> tag
if (context.options.isPreTag(tag)) {
const isPreTag = context.options.isPreTag(tag)
if (isPreTag) {
context.inPre = true
}

// Attributes.
let props = parseAttributes(context, type)

// check v-pre
if (
type === TagType.Start &&
Expand Down

0 comments on commit d2df28d

Please sign in to comment.