diffDOM icon indicating copy to clipboard operation
diffDOM copied to clipboard

Facing issue with skipping difference - preVirtualDiffApply

Open fahdarif opened this issue 2 years ago • 1 comments

I am facing an issue while skipping the difference. My use case is that I want to skip all the changes made to BODY element and I am using preVirtualDiffApply with true. It is looping me in infinite circle

Initializing: window.domDifferenceInstance = new DiffDOM({ preVirtualDiffApply: function (info) { if (info.node && info.node.nodeName === "BODY") { console.log("info", info); // Handle the specific condition for the BODY element console.log("Here's a special case involving the BODY element"); // Return true only for this specific condition return true; } return false; }, });

Using function: export function compareDoms(dom1: HTMLBodyElement | null) { if (!dom1) { return; } const updatedDOM = document.body.cloneNode(true) as HTMLBodyElement; const diff = window.domDifferenceInstance.diff(dom1, updatedDOM); console.log(diff);

const diffJson = JSON.stringify(diff); return diffJson; }

fahdarif avatar Dec 07 '23 07:12 fahdarif

Please provide a fully working example on jsdiff or similar so that I can immediately start working on the issue.

johanneswilm avatar Apr 05 '24 10:04 johanneswilm