Giter Club home page Giter Club logo

htmldiff's People

Contributors

christian-krupa avatar dehenne avatar ptsavdar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

htmldiff's Issues

Strange results when removing list items

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

<del> is outside of tag when changing 1st word of this tag

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.