jsondiffpatch icon indicating copy to clipboard operation
jsondiffpatch copied to clipboard

Not all unchanged elements are presented in html formatter's diff

Open Keniamin opened this issue 9 years ago • 4 comments

Let us compare json

[
    [{"id": 1, "diff": "none"}, {"id": 2, "diff": "none"}],
    [{"id": 1, "diff": "none"}, {"id": 2, "diff": "was"}]
]

with

[
    [{"id": 2, "diff": "none"}, {"id": 1, "diff": "none"}],
    [{"id": 2, "diff": "now"}, {"id": 1, "diff": "none"}]
]

That is, in first array we just swapped elements, while in the second one we also changed one of the elements. And now look to the screenshot how html formatter draws it when "show unchanged" option enabled. jsondifflib formatter bug In the first case it's ok, we can see unchanged element with id=1 and moved id=2. In the second case unchanged element is not present.

P.S. By the way, if one changes element with id=1 rather than id=2 diff would look even stranger (unexisting changes still related to id=2, like above): jsondifflib formatter bug 2

Keniamin avatar Feb 20 '15 15:02 Keniamin