diff --git a/src/compiler/parser/text-parser.js b/src/compiler/parser/text-parser.js index 284fca33bf4..cf82a62484f 100644 --- a/src/compiler/parser/text-parser.js +++ b/src/compiler/parser/text-parser.js @@ -3,7 +3,7 @@ import { cached } from 'shared/util' import { parseFilters } from './filter-parser' -const defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g +const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g const buildRegex = cached(delimiters => { diff --git a/test/unit/modules/compiler/parser.spec.js b/test/unit/modules/compiler/parser.spec.js index 1cdaa3b7171..32c1cc3580b 100644 --- a/test/unit/modules/compiler/parser.spec.js +++ b/test/unit/modules/compiler/parser.spec.js @@ -731,4 +731,10 @@ describe('parser', () => { expect(ast.children[1].isComment).toBe(true) // parse comment with ASTText expect(ast.children[1].text).toBe('comment here') }) + + // #8103 + it('should allow CRLFs in string interpolations', () => { + const ast = parse(`

{{\r\nmsg\r\n}}

`, baseOptions) + expect(ast.children[0].expression).toBe('_s(msg)') + }) })