]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-core): properly exit self-closing pre tag
authorEvan You <yyx990803@gmail.com>
Thu, 1 Jul 2021 19:34:12 +0000 (15:34 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 1 Jul 2021 19:34:12 +0000 (15:34 -0400)
fix #4030

packages/compiler-core/src/parse.ts

index ebae0ce214d886966bf9675113e4071ce91ef8d4..9e6ee3260961f43ff7850df50bab0089bf415fdd 100644 (file)
@@ -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
   }
 
@@ -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 &&