HTML DOM Element isEqualNode() Method
- Previous Page isDefaultNamespace()
- Next Page isSameNode()
- Go Back to the Previous Level HTML DOM Elements Object
Definition and Usage
isEqualNode()
the method checks whether two nodes are equal.
If two elements (or nodes) are equal,isEqualNode()
Returns true
.
If all of the following conditions are true, the two nodes are equal:
- They have the same nodeType
- They have the same nodeName
- They have the same NodeValue
- They have the same nameSpaceURI
- They have the same childNodes and all of its descendants
- They have the sameAttributesand attribute values
- They have the same localName and prefix
Tip:Note: isSameNode() Method to detect whether two nodes are the same node.
See also:
Example
Check if two list items in two different lists are equal:
var item1 = document.getElementById("myList1").firstChild; var item2 = document.getElementById("myList2").firstChild; var x = item1.isEqualNode(item2);
Syntax
element.isEqualNode(node)
or
node.isEqualNode(node)
Parameter
Parameter | Description |
---|---|
node | Required. The node to be compared. |
Return Value
Type | Description |
---|---|
Boolean Value | Returns true if two nodes are equal, otherwise returns false. |
Browser Support
element.isEqualNode()
It is a DOM Level 3 (2004) feature.
All browsers fully support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | 9-11 | Support | Support | Support | Support |
- Previous Page isDefaultNamespace()
- Next Page isSameNode()
- Go Back to the Previous Level HTML DOM Elements Object