The isSameNode() method tests whether two nodes are the same node.
Tip: Use the isEqualNode() method to determine if two nodes are equal.
The isSameNode() method is supported in all major browsers.
Note: Internet Explorer 9 and earlier do not support the isSameNode() method.
Parameter | Type | Description |
---|---|---|
nodetocheck | Node object | Required. The node to compare with the current node |
Type | Description |
---|---|
Boolean | true if the two nodes are the same, otherwise false |
DOM Version | Core Level 3 Node Object |
---|
The following code fragment loads "books.xml" into xmlDoc using loadXMLDoc() and tests whether the two nodes are the same node:
Output: