icaplyon1 / htmldiff Goto Github PK
View Code? Open in Web Editor NEWA PHP5 library that diffs (compares) HTML files.
License: Other
A PHP5 library that diffs (compares) HTML files.
License: Other
Please update your README.md to reflect the proper repository name on Packagist.
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.
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
Example:
<h1>Enormous spider</h1>
=> <h1>Huge spider</h1>
After applying HtmlDiff:
<del class="diff-html-removed" id="removed-htmldiff-0">Enormous </del><h1><ins class="diff-html-added" id="added-htmldiff-0">Huge </ins>spider</h1>
<del>
is outside of <h1>
tag, which looks wrong in diff preview.
The same behaviour for <p>
tag, it looks like the word was removed from other paragraph.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.