php-htmldiff icon indicating copy to clipboard operation
php-htmldiff copied to clipboard

Diff fails on image as a link inside a table

Open sebreb opened this issue 2 years ago • 0 comments

Hello and thank you for this awesome library! I am reporting an issue tested in https://php-htmldiff.caxy.com/. The diff doesn't detect the left image deletion in the following 2-cells-table:

OLD

<table>
    <tbody>
        <tr>
            <td><a href="#somewhere"><img src="https://fr.wikipedia.org/static/images/mobile/copyright/wikipedia.png"/></a></td>
            <td><img src="https://fr.wikipedia.org/static/images/mobile/copyright/wikipedia.png"/></td>
        </tr>
    </tbody>
</table>

NEW

<table>
    <tbody>
        <tr>
        <td></td>
        <td><img src="https://fr.wikipedia.org/static/images/mobile/copyright/wikipedia.png"/></td>
        </tr>
    </tbody>
</table>

RESULT

<table>
    <tbody>
        <tr>
            <td rowspan="1" colspan="1">
                <a href="#somewhere" class="diffmod">
                    <img src="https://fr.wikipedia.org/static/images/mobile/copyright/wikipedia.png" alt="wikipedia.png">
                </a>
                <del class="diffmod"> </del>
                <ins class="diffmod"></ins>
            </td>
            <td rowspan="1" colspan="1">
                <img src="https://fr.wikipedia.org/static/images/mobile/copyright/wikipedia.png" alt="wikipedia.png">
            </td>
        </tr>
    </tbody>
</table>
  • If I extract the first image from tag or if I add a space inside this tag, the deletion is detected inside the cell.
  • If I remove the second column in both OLD and NEW, the deletion of the left image link is detected at the level.

    I would like the diff to detect the image deletion, does anybody know how to achieve this goal ? Thank you in advance,

sebreb avatar Jun 24 '22 13:06 sebreb