Convert entities of all text nodes

pull/89/head
Fabrice Weinberg 8 years ago
parent 496eff7e54
commit 4b9832f03a

@ -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();
}
}

@ -0,0 +1 @@
<p>Hello &amp; World</p>

@ -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
}
Loading…
Cancel
Save