MCPcopy Create free account
hub / github.com/microsoft/SandDance / findScrollableParent

Function findScrollableParent

docs/app/js/sanddance-app.js:21575–21596  ·  view source on GitHub ↗
(startingElement)

Source from the content-addressed store, hash-verified

21573 return _scrollbarWidth;
21574}
21575function findScrollableParent(startingElement) {
21576 var el = startingElement;
21577 var doc = (0, _getDocument.getDocument)(startingElement);
21578 // First do a quick scan for the scrollable attribute.
21579 while(el && el !== doc.body){
21580 if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) === "true") return el;
21581 el = el.parentElement;
21582 }
21583 // If we haven't found it, the use the slower method: compute styles to evaluate if overflow is set.
21584 el = startingElement;
21585 while(el && el !== doc.body){
21586 if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) !== "false") {
21587 var computedStyles = getComputedStyle(el);
21588 var overflowY = computedStyles ? computedStyles.getPropertyValue("overflow-y") : "";
21589 if (overflowY && (overflowY === "scroll" || overflowY === "auto")) return el;
21590 }
21591 el = el.parentElement;
21592 }
21593 // Fall back to window scroll.
21594 if (!el || el === doc.body) el = (0, _getWindow.getWindow)(startingElement);
21595 return el;
21596}
21597
21598},{"./dom/getDocument":"bYcmK","@uifabric/merge-styles":"7c43M","./dom/getWindow":"8f64x","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"bYcmK":[function(require,module,exports) {
21599var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers 1

_preventOverscrollingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected