diff --git a/compiler/parse/state/tag.js b/compiler/parse/state/tag.js index e8c627c93a..457ed4f950 100644 --- a/compiler/parse/state/tag.js +++ b/compiler/parse/state/tag.js @@ -57,12 +57,12 @@ export default function tag ( parser ) { const lastChild = element.children[ element.children.length - 1 ]; if ( firstChild.type === 'Text' ) { - firstChild.data = trimStart( firstChild.data ); + firstChild.data = trimStart( decodeCharacterReferences( firstChild.data ) ); if ( !firstChild.data ) element.children.shift(); } if ( lastChild.type === 'Text' ) { - lastChild.data = trimEnd( lastChild.data ); + lastChild.data = trimEnd( decodeCharacterReferences( lastChild.data ) ); if ( !lastChild.data ) element.children.pop(); } } diff --git a/test/parser/convert-entities/input.html b/test/parser/convert-entities/input.html new file mode 100644 index 0000000000..bc5c086536 --- /dev/null +++ b/test/parser/convert-entities/input.html @@ -0,0 +1 @@ +

Hello & World

diff --git a/test/parser/convert-entities/output.json b/test/parser/convert-entities/output.json new file mode 100644 index 0000000000..b086da06eb --- /dev/null +++ b/test/parser/convert-entities/output.json @@ -0,0 +1,27 @@ +{ + "hash": 1090309355, + "html": { + "start": 0, + "end": 24, + "type": "Fragment", + "children": [ + { + "start": 0, + "end": 24, + "type": "Element", + "name": "p", + "attributes": [], + "children": [ + { + "start": 3, + "end": 20, + "type": "Text", + "data": "Hello & World" + } + ] + } + ] + }, + "css": null, + "js": null +}