Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested/unclosed tags on attribute differences #113

Open
ESI-Lille-devops opened this issue Nov 29, 2022 · 0 comments
Open

nested/unclosed tags on attribute differences #113

ESI-Lille-devops opened this issue Nov 29, 2022 · 0 comments
Labels

Comments

@ESI-Lille-devops
Copy link

ESI-Lille-devops commented Nov 29, 2022

When comparing identical tags (tag and content), of which one has an attribute that the other doesn't, the produced output presents two opening tags, the identical content, and only one closing tag.
Also, although I am not sure of what the expected behavior is, if both have the attribute, with different values, no difference is detected and the output is the old html.
The following code

<?php

require_once 'vendor/autoload.php';

use Caxy\HtmlDiff\HtmlDiff;

function compare($old, $new) {
    echo (new HtmlDiff($new, $old))->build() . "\n";
}

compare(
    '<p title="A">content</p>',
    '<p>content</p>'
);
compare(
    '<p>content</p>',
    '<p class="A">content</p>'
);
compare(
    '<p title="A">content</p>',
    '<p title="B">content</p>'
);

outputs the following :

<p class="diffmod"><p title="A" class="diffmod">content</p>
<p class="diffmod A"><p class="diffmod">content</p>
<p title="A">content</p>
@jschroed91 jschroed91 added the Bug label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants