Skip to content

Commit

Permalink
improve template parser HTML entity regex (fix vuejs#2021)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 14, 2015
1 parent afc15aa commit eec2cdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parsers/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function isRealTemplate (node) {
}

const tagRE = /<([\w:]+)/
const entityRE = /&\w+;|&#\d+;|&#x[\dA-F]+;/
const entityRE = /&#?\w+?;/

/**
* Convert a string template to a DocumentFragment.
Expand Down
5 changes: 5 additions & 0 deletions test/unit/specs/parsers/template_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ describe('Template Parser', function () {
expect(res instanceof DocumentFragment).toBeTruthy()
expect(res.childNodes.length).toBe(1)
expect(res.firstChild.nodeValue).toBe('hello / hello')
// #2021
res = parse('&#xe604;')
expect(res instanceof DocumentFragment).toBeTruthy()
expect(res.childNodes.length).toBe(1)
expect(res.firstChild.nodeValue).toBe('')
})

it('should parse textContent if argument is a script node', function () {
Expand Down

0 comments on commit eec2cdb

Please sign in to comment.