Explorar el Código

only preserve whitespace if it is not right after starting tag

Evan You hace 10 años
padre
commit
e223b87bd3
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      src/compiler/parser/index.js

+ 2 - 1
src/compiler/parser/index.js

@@ -112,7 +112,8 @@ export function parse (template, preserveWhitespace) {
       }
       text = currentParent.tag === 'pre' || text.trim()
         ? decodeHTML(text)
-        : preserveWhitespace ? ' ' : null
+        // only preserve whitespace if its not right after a starting tag
+        : preserveWhitespace && currentParent.children.length ? ' ' : null
       if (text) {
         let expression
         if (text !== ' ' && (expression = parseText(text))) {