Skip to content

Commit

Permalink
fix(parser): allow CRLFs in string interpolations (#8408)
Browse files Browse the repository at this point in the history
fix #8103
  • Loading branch information
haoqunjiang authored and yyx990803 committed Oct 24, 2018
1 parent a64ff19 commit 8f04135
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 8f04135

Please sign in to comment.