HTML DOM isSameNode() Method

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








googletag.cmd.push(function() googletag.display('div-gpt-ad-1422003450156-2'); );




HTML DOM isSameNode() Method


Element Object




Example


Check if two nodes are, in fact, the same node:



var item1 = document.getElementById("myList1");      // An <ul> element with id="myList"

var item2 = document.getElementsByTagName("UL")[0];  // The first <ul> element in the document

var x =
item1.isSameNode(item2);

<!--

The result of x will be:



true
-->
Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage


The isSameNode() method checks if two nodes are the same node.


The isSameNode() method returns true if the two nodes are the same node, otherwise false.


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



Browser Support


The numbers in the table specify the first browser version that fully supports the method.














Method
isSameNode() Yes 9.0 Not supported Yes Yes

Note: Firefox stopped supporting this method as of version
10, because the method has been deprecated in the DOM version 4. Instead, you
should use === to compare if two nodes are the same (See "More Examples" below).



Syntax




node.isSameNode(node)


Parameter Values








ParameterType Description
nodeNode objectRequired. The node you want to compare the specified node with






googletag.cmd.push(function() googletag.display('div-gpt-ad-1493883843099-0'); );





Technical Details






Return Value: A Boolean, returns true if the two nodes are the same node, otherwise false
DOM Version Core Level 3 Node Object

More Examples




Example


Using the === operator to check if two nodes are the same node:



var item1 = document.getElementById("myList");
var item2 = document.getElementsByTagName("UL")[0];

if (item1 === item2)
  alert("THEY ARE THE SAME!!");
else
  alert("They are not the same.");

Try it Yourself »


Element Object


Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ