Summary
getItemDifferences in the compare diff engine has two bugs that cause it to silently miss changes:
- Object comparison only iterates keys from the old value — properties that were added in the new version are never compared and produce no change entries
- Array comparison only iterates the old array's length — if the new array has additional elements, they are ignored
This means nodes with newly added properties or longer arrays are detected as changed by generateDiff but produce zero change entries from getItemDifferences, making them invisible in the compare output despite being rendered on the SVG canvas.
Additional: allChanges option
A new allChanges render option was added to compare(). When true, position-changed nodes also get their full property diff instead of being short-circuited by otherChanges = false. This allows getting a complete set of change entries with highlight() functions for every changed node.
Fix
getItemDifferences (objects): iterate the union of both objects' keys instead of only Object.keys(value1)
getItemDifferences (arrays): use Math.max of both array lengths instead of value1.length
compare() / diffProcessor / getTabChanges: accept and forward allChanges option
Summary
getItemDifferencesin the compare diff engine has two bugs that cause it to silently miss changes:This means nodes with newly added properties or longer arrays are detected as changed by
generateDiffbut produce zero change entries fromgetItemDifferences, making them invisible in the compare output despite being rendered on the SVG canvas.Additional:
allChangesoptionA new
allChangesrender option was added tocompare(). Whentrue, position-changed nodes also get their full property diff instead of being short-circuited byotherChanges = false. This allows getting a complete set of change entries withhighlight()functions for every changed node.Fix
getItemDifferences(objects): iterate the union of both objects' keys instead of onlyObject.keys(value1)getItemDifferences(arrays): useMath.maxof both array lengths instead ofvalue1.lengthcompare()/diffProcessor/getTabChanges: accept and forwardallChangesoption