Created
July 14, 2012 02:10
-
-
Save toruta39/3108816 to your computer and use it in GitHub Desktop.
Detect if otherNode is contained by refNode
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
//Detect if otherNode is contained by refNode | |
function contains(refNode, otherNode) { | |
var node = other.Node.parerntNode; | |
do { | |
if (node === refNode) { | |
return true; | |
} else { | |
node = node.parentNode; | |
} | |
} while (node !== null); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment