-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hello,
first of all I would like to thank you for your amazing library which satisfies almost all of our use cases.
While testing the library I discovered that removing items from lists don't seem to work.
The case
Old HTML:
<ol>
<li>1</li>
<li>2</li>
<li>3</li>
</ol>
New HTML (first and second list item removed):
<ol>
<li>3</li>
</ol>
Expected result:
<ol>
<li><del class="diff-html-removed" id="removed-htmldiff-0">1</del></li>
<li><del class="diff-html-removed" id="removed-htmldiff-1">2</del></li>
<li>3</li>
</ol>
Actual result:
<li>
<del class="diff-html-removed" id="removed-htmldiff-0">1</del>
</li>
<ol>
<li>3</li>
</ol>
So the first <li>-element got moved out of the <ol>-Container and the second <li>-Element did just disappear.
Code to reproduce bug:
<?php
require_once 'vendor/autoload.php';
$old = '<ol><li>1</li><li>2</li><li>3</li></ol>';
$new = '<ol><li>3</li></ol>';
$diff = new Icap\HtmlDiff\HtmlDiff($old, $new, true);
$out = $diff->outputDiff();
echo $out->toString();
You dont have to use a <ol>-Element to reproduce this bug. It happens on every element:
Old HTML: <testing><asd>1</asd><asd>2</asd><asd>3</asd></testing>
New HTML: <testing><asd>3</asd></testing>
Result:
<asd>
<del class="diff-html-removed" id="removed-htmldiff-0">1</del>
</asd>
<testing>
<asd>3</asd>
</testing>
I would kindly appreciate any help or idea on how to fix this issue.
Thanks and best regards,
Niklas
Metadata
Metadata
Assignees
Labels
No labels