When I want to parse an HTML string like this one <p>one <strong>two</strong></p>, the first TextNode child (#text) of the P tag does not contain the value one.
The issue comes from the text node which is serialized with parse5 while parse5 computes the text value from the childNodes, which a TextNode has not.
Brief bug description
When I want to parse an HTML string like this one
<p>one <strong>two</strong></p>
, the firstTextNode
child (#text
) of theP
tag does not contain the valueone
.The issue comes from the text node which is serialized with parse5 while parse5 computes the text value from the
childNodes
, which aTextNode
has not.If you replace the parentNode instead of adding it to the childNodes, it works better: https://github.com/kontent-ai/kontent-delivery-node-parser/blob/master/lib/parser/implementation/shared.ts#L160
Test environment