Skip to content

Instantly share code, notes, and snippets.

@allenwb
Created March 26, 2013 22:57
Show Gist options
  • Save allenwb/5250084 to your computer and use it in GitHub Desktop.
Save allenwb/5250084 to your computer and use it in GitHub Desktop.
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