SHARE
TWEET

Untitled

a guest Jun 19th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function isSuperChild(child, superparent){
  2.         if(typeof child == 'string'){ child = document.getElementById(child); }
  3.         if(typeof superparent == 'string'){ superparent = document.getElementById(superparent); }
  4.        
  5.         if(child.tagName.toLowerCase() == 'body') return false;
  6.         else parent = child.parentNode;
  7.        
  8.         while(parent){
  9.             if(parent == superparent) return true;
  10.             else parent = parent.parentNode;
  11.             if(parent.tagName.toLowerCase() == 'body') return false;
  12.         };
  13.         return false;
  14.     }
RAW Paste Data
Top