题解 | #dom 节点查找#
dom 节点查找
http://www.nowcoder.com/practice/74d74be449af4c66907fe2d6961c255c
使用递归
function commonParentNode(oNode1, oNode2) { let parent1 = oNode1.parentNode; let parent2 = oNode2.parentNode; if(parent1 === parent2){ return parent1 }else{ commonParentNode(parent1,parent2) } }