Created
July 21, 2016 10:13
-
-
Save bhavyaw/fbe10bd7a6ad8d0d62318afa208744e8 to your computer and use it in GitHub Desktop.
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 elementChecker(element,selectorName,selectorValue){ | |
// if this node is not the one we want, move up the dom tree | |
while (element != null && element[selectorName] != selectorValue) { | |
element = element.parentNode; | |
} | |
// at this point we have found our containing div or we are out of parent nodes | |
var insideMyDiv = (element != null && element[selectorName] == selectorValue); | |
return { | |
clicked : insideMyDiv, | |
element : element | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment