-
Notifications
You must be signed in to change notification settings - Fork 103
Description
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;
}