File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
src/server/optimizing-compiler Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ import {
2222 applyModelTransform
2323} from './modules'
2424
25+ import { escape } from 'web/server/util'
2526import { optimizability } from './optimizer'
26-
2727import type { CodegenResult } from 'compiler/codegen/index'
2828
2929export type StringSegment = {
@@ -222,7 +222,7 @@ function nodesToSegments (
222222 } else if ( c . type === 2 ) {
223223 segments . push ( { type : INTERPOLATION , value : c . expression } )
224224 } else if ( c . type === 3 ) {
225- segments . push ( { type : RAW , value : c . text } )
225+ segments . push ( { type : RAW , value : escape ( c . text ) } )
226226 }
227227 }
228228 return segments
Original file line number Diff line number Diff line change @@ -908,6 +908,15 @@ describe('SSR: renderToString', () => {
908908 done ( )
909909 } )
910910 } )
911+
912+ it ( 'should escape static strings' , done => {
913+ renderVmWithOptions ( ( {
914+ template : `<div><foo></div>`
915+ } ) , res => {
916+ expect ( res ) . toBe ( `<div data-server-rendered="true"><foo></div>` )
917+ done ( )
918+ } )
919+ } )
911920} )
912921
913922function renderVmWithOptions ( options , cb ) {
You can’t perform that action at this time.
0 commit comments