docs: function getScrollElementFromTarget(elem, stopParent) {
          stopParent = stopParent || document;
          if (!elem) {
              return stopParent;
          }
  
          var position = elem.style.position,
              excludeStaticParent = position === 'absolute',
              overflowRegex = /(auto|scroll)/,
              scrollParent = elem;
  
          while (!!scrollParent && scrollParent !== stopParent) {
              if (!(excludeStaticParent && scrollParent.style.position === 'static')) {
                  var computedStyle = getComputedStyle(scrollParent);
  
                  if (overflowRegex.test(computedStyle.overflow + computedStyle.overflowY + computedStyle.overflowX)) {
                      break;
                  }
              }
  
              scrollParent = scrollParent.parentElement;
          }
  
          return position === 'fixed' || !scrollParent || scrollParent === elem ? elem.ownerDocument || stopParent : scrollParent;
      }