Implement a function identicalDomTrees(node1, node2) that determines whether two DOM trees are identical.
The function should:
true if the entire structures are the same, otherwise false.Example
const doc1 = new DOMParser().parseFromString( '<div><span>Hi</span><p>Bye</p></div>', 'text/html' ); const doc2 = new DOMParser().parseFromString( '<div><span>Hi</span><p>Bye</p></div>', 'text/html' ); identicalDomTrees(doc1.body, doc2.body); // true const doc3 = new DOMParser().parseFromString( '<div><span>Hello</span><p>Bye</p></div>', 'text/html' ); identicalDomTrees(doc1.body, doc3.body); // false
JavaScript Function
No test results yet
Click "Run" to execute tests