XML DOM isSameNode() နည်းလမ်း
❮ Node Object
ဥပမာ
အောက်ဖော်ပြပါ ကုဒ်အပိုင်းအစသည် " books.xml " ကို xmlDoc ထဲသို့ တင်ပေးပြီး node နှစ်ခုသည် တူညီသော node ဟုတ်မဟုတ် စမ်းသပ်သည်။
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);
}
အထွက်-
true
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
isSameNode() method သည် node နှစ်ခုသည် node တူညီခြင်းရှိမရှိ စမ်းသပ်သည်။
အကြံပြုချက်- node နှစ်ခု တူညီမှုရှိမရှိ ဆုံးဖြတ်ရန် isEqualNode() နည်းလမ်းကို အသုံးပြု ပါ။
Browser ပံ့ပိုးမှု
isSameNode() နည်းလမ်းကို အဓိက ဘရောက်ဆာအားလုံးတွင် ပံ့ပိုးထားသည်။
မှတ်ချက်- Internet Explorer 9 နှင့် အထက်တွင် isSameNode() နည်းလမ်းကို မပံ့ပိုးပါ။
အထားအသို
nodeObject.isSameNode(nodetocheck)
ကန့်သတ်ချက်များ
Parameter | Type | Description |
---|---|---|
nodetocheck | Node object | Required. The node to compare with the current node |
တန်ဖိုးကို ပြန်ပေးသည်။
Type | Description |
---|---|
Boolean | true if the two nodes are the same, otherwise false |
နည်းပညာဆိုင်ရာအသေးစိတ်
DOM ဗားရှင်း | Core Level 3 Node Object |
---|
❮ Node Object