javascript/atoms/dom.js
function getOverflowParent(e) {
    var position = bot.dom.getEffectiveStyle(e, 'position');
    if (position == 'fixed') {
      treatAsFixedPosition = true;
      // Fixed-position element may only overflow the viewport.
      return e == htmlElem ? null : htmlElem;
    } else {
      var parent = bot.dom.getParentElement(e);
      while (parent && !canBeOverflowed(parent)) {
        parent = bot.dom.getParentElement(parent);
      }
      return parent;
    }

    function canBeOverflowed(container) {
      // The HTML element can always be overflowed.
      if (container == htmlElem) {
        return true;
      }
      // An element cannot overflow an element with an inline or contents display style.
      var containerDisplay = /** @type {string} */ (
          bot.dom.getEffectiveStyle(container, 'display'));
      if (goog.string.startsWith(containerDisplay, 'inline') ||
          (containerDisplay == 'contents')) {
        return false;
      }
      // An absolute-positioned element cannot overflow a static-positioned one.
      if (position == 'absolute' &&
          bot.dom.getEffectiveStyle(container, 'position') == 'static') {
        return false;
      }
      return true;
    }
  }
function getOverflowParent(e) {
    var position = bot.dom.getEffectiveStyle(e, 'position');
    if (position == 'fixed') {
      treatAsFixedPosition = true;
      // Fixed-position element may only overflow the viewport.
      return e == htmlElem ? null : htmlElem;
    } else {
      var parent = bot.dom.getParentElement(e);
      while (parent && !canBeOverflowed(parent)) {
        parent = bot.dom.getParentElement(parent);
      }
      return parent;
    }

    function canBeOverflowed(container) {
      // The HTML element can always be overflowed.
      if (container == htmlElem) {
        return true;
      }
      // An element cannot overflow an element with an inline or contents display style.
      var containerDisplay = /** @type {string} */ (
          bot.dom.getEffectiveStyle(container, 'display'));
      if (goog.string.startsWith(containerDisplay, 'inline') ||
          (containerDisplay == 'contents')) {
        return false;
      }
      // An absolute-positioned element cannot overflow a static-positioned one.
      if (position == 'absolute' &&
          bot.dom.getEffectiveStyle(container, 'position') == 'static') {
        return false;
      }
      return true;
    }
  }
function getOverflowParent ( e ) { var position = bot . dom . getEffectiveStyle ( e , 'position' ) ; if ( position == 'fixed' ) { treatAsFixedPosition = true ; // Fixed-position element may only overflow the viewport. return e == htmlElem ? null : htmlElem ; } else { var parent = bot . dom . getParentElement ( e ) ; while ( parent && ! canBeOverflowed ( parent ) ) { parent = bot . dom . getParentElement ( parent ) ; } return parent ; } function canBeOverflowed ( container ) { // The HTML element can always be overflowed. if ( container == htmlElem ) { return true ; } // An element cannot overflow an element with an inline or contents display style. var containerDisplay = /** @type {string} */ ( bot . dom . getEffectiveStyle ( container , 'display' ) ) ; if ( goog . string . startsWith ( containerDisplay , 'inline' ) || ( containerDisplay == 'contents' ) ) { return false ; } // An absolute-positioned element cannot overflow a static-positioned one. if ( position == 'absolute' && bot . dom . getEffectiveStyle ( container , 'position' ) == 'static' ) { return false ; } return true ; } }
Return the closest ancestor that the given element may overflow.
Return the closest ancestor that the given element may overflow .