Skip to content

Commit 1abe20b

Browse files
committed
fix(parser): allow CRLFs in string interpolations, fix vuejs#8103
1 parent 52719cc commit 1abe20b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/compiler/parser/text-parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { cached } from 'shared/util'
44
import { parseFilters } from './filter-parser'
55

6-
const defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g
6+
const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g
77
const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
88

99
const buildRegex = cached(delimiters => {

test/unit/modules/compiler/parser.spec.js

+6
Original file line numberDiff line numberDiff line change
@@ -717,4 +717,10 @@ describe('parser', () => {
717717
expect(ast.children[1].isComment).toBe(true) // parse comment with ASTText
718718
expect(ast.children[1].text).toBe('comment here')
719719
})
720+
721+
// #8103
722+
it('should allow CRLFs in string interpolations', () => {
723+
const ast = parse(`<p>{{\r\nmsg\r\n}}</p>`, baseOptions)
724+
expect(ast.children[0].expression).toBe('_s(msg)')
725+
})
720726
})

0 commit comments

Comments
 (0)