Selaa lähdekoodia

only preserve whitespace if it is not right after starting tag

Evan You 10 vuotta sitten
vanhempi
commit
e223b87bd3
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  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()
       text = currentParent.tag === 'pre' || text.trim()
         ? decodeHTML(text)
         ? decodeHTML(text)
-        : preserveWhitespace ? ' ' : null
+        // only preserve whitespace if its not right after a starting tag
+        : preserveWhitespace && currentParent.children.length ? ' ' : null
       if (text) {
       if (text) {
         let expression
         let expression
         if (text !== ' ' && (expression = parseText(text))) {
         if (text !== ' ' && (expression = parseText(text))) {