code: function (element, child) {
      if (element === document) {
        element = document.documentElement || document.body.parentElement
      }
      while (child) {
        if (element === child) {
          return true
        }
        child = child.parentElement
      }
      return false
    }
docs: /* istanbul ignore next