voku/simple_html_dom

First comment is removed (and it causes issue in WP)

maximebj opened this issue · 2 comments

Hi,

I'm using Simple HTML DOM in WordPress and an issue occurs with the new content editor (Gutenberg)

If I parse the content of the post (to add anchors on titles for example) and save it again, I'll get an issue because the lib seems to remove the first HTML comment.

Comments are essentials in the content editor because they are used to keep track of blocks.
for example :

<!-- wp:heading -->
<h2 id="my-title">Level 2 title</h2>
<!-- /wp:heading -->

the first one is always trimed (that was not the case with the old library though).

Do you know if something in the code removes on purpose the first line if it's an HTML comment ? Is it possible to disable it ?

voku commented

Thanks for the bug report, fixed in version 4.7.14

Thank you very much ! Fast and efficient, great work !