题目查找两个节点的最近的一个共同父节点,可以包括节点自身
function commonParentNode(oNode1, oNode2) {
while(oNode1){
if(oNode1.contains(oNode2)){
return oNode1
}else{
oNode1=oNode1.parentNode
}
}
}
2024-01-28 08:52:28
function commonParentNode(oNode1, oNode2) {
while(oNode1){
if(oNode1.contains(oNode2)){
return oNode1
}else{
oNode1=oNode1.parentNode
}
}
}