How to validate if 2 DOM structures are the same without comparing the content?

Viewed 89

I want to validate if two given html elements are the same without comparing the data in it. I just want to match the DOM structure and attributes.

For eg.

HTML element 1:

<div class="abc def">
    <div id="123">
        This is some text
    </div>
    Text1
</div>

HTML element 2:

<div class="def abc">
    <div id="123">
        This is some text v2
    </div>
    Text2
</div>

HTML element 1 has same structure as HTML element 2(dom and attributes), but the text(data) is different. I want this to return true.

0 Answers
Related