Skip to content

Instantly share code, notes, and snippets.

@a1exlism
Last active March 17, 2018 15:43
Show Gist options
  • Save a1exlism/a204602346aedeb47621195cf6fa101b to your computer and use it in GitHub Desktop.
Save a1exlism/a204602346aedeb47621195cf6fa101b to your computer and use it in GitHub Desktop.
do NOT forget `return`
function commonParentNode(oNode1, oNode2) {
if (oNode1.contains(oNode2)) {
return oNode1;
} else {
return commonParentNode(oNode1.parentNode, oNode2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment