MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / getOverflowParent

Function getOverflowParent

javascript/atoms/dom.js:676–709  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

674
675 // Return the closest ancestor that the given element may overflow.
676 function getOverflowParent(e) {
677 var position = bot.dom.getEffectiveStyle(e, 'position');
678 if (position == 'fixed') {
679 treatAsFixedPosition = true;
680 // Fixed-position element may only overflow the viewport.
681 return e == htmlElem ? null : htmlElem;
682 } else {
683 var parent = bot.dom.getParentElement(e);
684 while (parent && !canBeOverflowed(parent)) {
685 parent = bot.dom.getParentElement(parent);
686 }
687 return parent;
688 }
689
690 function canBeOverflowed(container) {
691 // The HTML element can always be overflowed.
692 if (container == htmlElem) {
693 return true;
694 }
695 // An element cannot overflow an element with an inline or contents display style.
696 var containerDisplay = /** @type {string} */ (
697 bot.dom.getEffectiveStyle(container, 'display'));
698 if (goog.string.startsWith(containerDisplay, 'inline') ||
699 (containerDisplay == 'contents')) {
700 return false;
701 }
702 // An absolute-positioned element cannot overflow a static-positioned one.
703 if (position == 'absolute' &&
704 bot.dom.getEffectiveStyle(container, 'position') == 'static') {
705 return false;
706 }
707 return true;
708 }
709 }
710
711 // Return the x and y overflow styles for the given element.
712 function getOverflowStyles(e) {

Callers 1

dom.jsFile · 0.70

Calls 1

canBeOverflowedFunction · 0.70

Tested by

no test coverage detected