The isEqualNode() method of the Node interface tests whether two nodes are equal.
isEqualNode()
MDN Reference