Skip to content

Commit

Permalink
fix(parser): allow CRLFs in string interpolations (vuejs#8408)
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea authored and hefeng committed Jan 25, 2019
1 parent 5665758 commit 7bffd68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/parser/text-parser.js
Expand Up @@ -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 => {
Expand Down
6 changes: 6 additions & 0 deletions test/unit/modules/compiler/parser.spec.js
Expand Up @@ -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(`<p>{{\r\nmsg\r\n}}</p>`, baseOptions)
expect(ast.children[0].expression).toBe('_s(msg)')
})
})

0 comments on commit 7bffd68

Please sign in to comment.