-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
Description
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>