Comparing nodes disregarding content

Hi there, can anyone think of a reliable way of comparing two nodes but disregarding their contents? I have seen that node.isEqualNode(node2); does almost what I need except it considers as well the content.

Many thanks for your help

You could compare non-deep clones of those nodes, which will disregard their children – like

node1.cloneNode().isEqualNode(node2.cloneNode())
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.