code: function() {
    if (!global.document) {
      return true;
    }
    return global.document.documentElement.compareDocumentPosition ?
      function (a, b) {
        return !!(a.compareDocumentPosition(b) & 16);
      } :
      global.document.documentElement.contains ?
        function (a, b) {
          return a !== b && ( a.contains ? a.contains(b) : false );
        } :
        function (a, b) {
          while (b = b.parentNode) {
            if (b === a) {
              return true;
            }
          }
          return false;
        };
  }
docs: https://github.com/jquery/sizzle/blob/3136f48b90e3edc84cbaaa6f6f7734ef03775a07/sizzle.js#L708