MCPcopy Index your code
hub / github.com/SortableJS/Sortable / getParentAutoScrollElement

Function getParentAutoScrollElement

src/utils.js:432–456  ·  view source on GitHub ↗
(el, includeSelf)

Source from the content-addressed store, hash-verified

430
431
432function getParentAutoScrollElement(el, includeSelf) {
433 // skip to window
434 if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
435
436 let elem = el;
437 let gotSelf = false;
438 do {
439 // we don't need to get elem css if it isn't even overflowing in the first place (performance)
440 if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
441 let elemCSS = css(elem);
442 if (
443 elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') ||
444 elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')
445 ) {
446 if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
447
448 if (gotSelf || includeSelf) return elem;
449 gotSelf = true;
450 }
451 }
452 /* jshint boss:true */
453 } while (elem = elem.parentNode);
454
455 return getWindowScrollingElement();
456}
457
458function extend(dst, src) {
459 if (dst && src) {

Callers 1

isScrolledPastFunction · 0.70

Calls 2

cssFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…