Created
March 26, 2013 22:57
-
-
Save allenwb/5250084 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
Object.isAncestorOf = function isAncestorOf(parent,child) { | |
if (child===null || child===undefined) return false; | |
if (parent === null) return true; | |
child = Object(child); | |
var proto = Object.getPrototypeOf(child); | |
if (proto === parent) return true; | |
return isAncestorOf(parent,proto); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment