isSameNode
Summary
Determines if two nodes are the same node.
Syntax
var isSame = node.isSameNode(/* see parameter list */);
Parameters
otherNode
- Data-type
- DOM Node
The node to be compared to the node that is executing the method.
Return Value
Returns an object of type BooleanBoolean
Whether the node specified in the otherNode parameter refers to the same node.
Examples
In the following example isSameNode is false since document.body is the body node while document.documentElement is the html node.
var isSameNode = document.body..isSameNode(document.documentElement);
Usage
This determines whether or not two references refer to the same node. If the references refer to the same node, you can use the references interchangeably, even when using a proxy.
Notes
Obsolete This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. In browsers where isSameNode is no longer supported // Instead of using node1.isSameNode(node2)
// use node1 Template:=== node2 // or node1 Template:== node2
Related specifications
- DOM Level 3 Core
- Recommendation
- DOM Level 4 Core
- Recommendation
Attributions
Mozilla Developer Network : [Node.isSameNode Article]
Microsoft Developer Network: [isSameNode Method Article]