Skip to content

Diff fails on image as a link inside a table  #110

Description

@sebreb

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,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions