From: Evan You Date: Thu, 1 Jul 2021 19:34:12 +0000 (-0400) Subject: fix(compiler-core): properly exit self-closing pre tag X-Git-Tag: v3.1.3~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2df28dca42f6679766033f8986b5637dfe64e1e;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-core): properly exit self-closing pre tag fix #4030 --- diff --git a/packages/compiler-core/src/parse.ts b/packages/compiler-core/src/parse.ts index ebae0ce214..9e6ee32609 100644 --- a/packages/compiler-core/src/parse.ts +++ b/packages/compiler-core/src/parse.ts @@ -425,6 +425,10 @@ function parseElement( const isVPreBoundary = context.inVPre && !wasInVPre if (element.isSelfClosing || context.options.isVoidTag(element.tag)) { + // #4030 self-closing
 tag
+    if (context.options.isPreTag(element.tag)) {
+      context.inPre = false
+    }
     return element
   }
 
@@ -528,14 +532,15 @@ function parseTag(
   const cursor = getCursor(context)
   const currentSource = context.source
 
-  // Attributes.
-  let props = parseAttributes(context, type)
-
   // check 
 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 &&