Last active
March 17, 2018 15:43
-
-
Save a1exlism/a204602346aedeb47621195cf6fa101b to your computer and use it in GitHub Desktop.
do NOT forget `return`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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