MCPcopy Create free account
hub / github.com/docker/getting-started / getScrollParent

Function getScrollParent

app/src/static/js/react-bootstrap.js:3112–3138  ·  view source on GitHub ↗

* Returns the scrolling parent of the given element * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} scroll parent

(element)

Source from the content-addressed store, hash-verified

3110
3111
3112function getScrollParent(element) {
3113 // Return body, `getScroll` will take care to get the correct `scrollTop` from it
3114 if (!element) {
3115 return document.body;
3116 }
3117
3118 switch (element.nodeName) {
3119 case 'HTML':
3120 case 'BODY':
3121 return element.ownerDocument.body;
3122
3123 case '#document':
3124 return element.body;
3125 } // Firefox want us to check `-x` and `-y` variations as well
3126
3127
3128 var _getStyleComputedProp = getStyleComputedProperty(element),
3129 overflow = _getStyleComputedProp.overflow,
3130 overflowX = _getStyleComputedProp.overflowX,
3131 overflowY = _getStyleComputedProp.overflowY;
3132
3133 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
3134 return element;
3135 }
3136
3137 return getScrollParent(getParentNode(element));
3138}
3139
3140var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
3141var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);

Callers 4

getBoundariesFunction · 0.85
attachToScrollParentsFunction · 0.85
setupEventListenersFunction · 0.85

Calls 2

getStyleComputedPropertyFunction · 0.85
getParentNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…