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

Function getParentAutoScrollElement

modular/sortable.core.esm.js:438–456  ·  view source on GitHub ↗
(el, includeSelf)

Source from the content-addressed store, hash-verified

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

Callers 3

isScrolledPastFunction · 0.70
AutoScrollPluginFunction · 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…