Skip to content

Facing issue with skipping difference - preVirtualDiffApply #135

@fahdarif

Description

@fahdarif

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions