Просмотр исходного кода

fix(ssr): fix double escaping of ssrNode attribute values (#7224)

This fixes a double escaping of attribute values in the SSR optimizing
compiler by unescaping the value in `genAttrSegment` because literal
attribute values get escaped early during `processAttrs` before it is
known, if this attribute will be optimized to an _ssrNode string template,
which is escaped as well, causing the double escape.

fix #7223
Felix Bünemann 8 лет назад
Родитель
Сommit
73a89bf9e5
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/server/optimizing-compiler/modules.js

+ 1 - 1
src/server/optimizing-compiler/modules.js

@@ -77,7 +77,7 @@ function genAttrSegment (name: string, value: string): StringSegment {
         ? ` ${name}="${name}"`
         : value === '""'
           ? ` ${name}`
-          : ` ${name}=${value}`
+          : ` ${name}="${JSON.parse(value)}"`
     }
   } else {
     return {