Easy Tutorial
❮ Dom Obj Color Prop Tableheader Cellindex ❯

HTML DOM isSameNode() Method

Element Object

Example

Check if two nodes are the same node:

Output result:


Definition and Usage

The isSameNode() method returns true if a node is the same as the given node, otherwise it returns false.

Tip: Use the isEqualNode() method to check if two nodes are equal but not necessarily the same node.


Browser Support

All major browsers support the isSameNode() method except Firefox.

Note: Firefox has dropped support for the isSameNode method after version 10, as the method was deprecated in DOM 4. You can use === to compare two elements instead.

Note: Internet Explorer 8 and earlier versions do not support this method.


Syntax

Parameters

Parameter Type Description
node Node object Required. The node you want to compare.

Return Value

Type Description
Boolean Returns true if the nodes are the same, otherwise returns false.

Technical Details

| DOM Version | Core Level 3 Node Object | | --- | --- |


Element Object

❮ Dom Obj Color Prop Tableheader Cellindex ❯