You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
A text node serialized with parse5 has no child so no value is returned.
With these changes, we check the type and avoid the serialization.
FIXESkontent-ai#4
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
The text was updated successfully, but these errors were encountered: