List Item is dropping text that follows a custom tag
Nickno95 opened this issue · comments
- <test></test> helloworld
This should render like this:
- <test></test> helloworld
However it is rendering like this:
- <test></test>
Dropping the "helloworld".
Follow up, the issue seems to be in the processTag function. Not sure what part is causing it yet.
$DOMDocument->replaceChild($DOMDocument->firstChild->firstChild->firstChild, $DOMDocument->firstChild);
This method meant to remove the html and body tags is causing sibling tags to get dropped.
If you have a list like this:
- <tag1></tag1> <tag2></tag2>
It will strip tag2 because it is replacing the firstchild (<html>
) with the firstChild (<tag>
) of the firstChild (<body>
) of the firstChild(<html>
). This is not good. It should be working like this:
$DOMDocument->replaceChild($DOMDocument->firstChild->firstChild->childNodes, $DOMDocument->firstChild);
However this replaceChild method doesn't accept an array of nodes.
Is this literally the only way to strip the <html>
and <body>
tags from the DOMDocument?