-
-
Save lirongfei123/567a616fd56273c16640e2837333afa0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// returns true if the element or one of its parents has the class classname | |
function hasSomeParentTheClass(element, classname) { | |
if (element.className.split(' ').indexOf(classname)>=0) return true; | |
return element.parentNode && hasSomeParentTheClass(element.parentNode, classname); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment