XML DOM isSameNode() Yöntemi
❮ Düğüm Nesnesi
Örnek
Aşağıdaki kod parçası, " books.xml " dosyasını xmlDoc'a yükler ve iki düğümün aynı düğüm olup olmadığını test eder:
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", "books.xml", true);
xhttp.send();
function myFunction(xml) {
var xmlDoc = xml.responseXML;
var x =
xmlDoc.getElementsByTagName('book')[1];
var y =
xmlDoc.getElementsByTagName('book')[1];
document.getElementById("demo").innerHTML =
x.isSameNode(y);
}
Çıktı:
true
Tanım ve Kullanım
isSameNode() yöntemi, iki düğümün aynı düğüm olup olmadığını test eder.
İpucu: İki düğümün eşit olup olmadığını belirlemek için isEqualNode() yöntemini kullanın.
Tarayıcı Desteği
isSameNode() yöntemi, tüm büyük tarayıcılarda desteklenir.
Not: Internet Explorer 9 ve önceki sürümleri isSameNode() yöntemini desteklemez.
Sözdizimi
nodeObject.isSameNode(nodetocheck)
parametreler
Parameter | Type | Description |
---|---|---|
nodetocheck | Node object | Required. The node to compare with the current node |
Geri dönüş değeri
Type | Description |
---|---|
Boolean | true if the two nodes are the same, otherwise false |
Teknik detaylar
DOM Sürümü | Çekirdek Düzey 3 Düğüm Nesnesi |
---|
❮ Düğüm Nesnesi