- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
24 lines
712 B
JavaScript
24 lines
712 B
JavaScript
import { isHTMLElement } from './is-element.mjs';
|
|
|
|
function isScrollParent(el) {
|
|
const win = el.ownerDocument.defaultView || window;
|
|
const { overflow, overflowX, overflowY } = win.getComputedStyle(el);
|
|
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
}
|
|
function getParent(el) {
|
|
if (el.localName === "html")
|
|
return el;
|
|
return el.assignedSlot || el.parentElement || el.ownerDocument.documentElement;
|
|
}
|
|
function getScrollParent(el) {
|
|
if (["html", "body", "#document"].includes(el.localName)) {
|
|
return el.ownerDocument.body;
|
|
}
|
|
if (isHTMLElement(el) && isScrollParent(el)) {
|
|
return el;
|
|
}
|
|
return getScrollParent(getParent(el));
|
|
}
|
|
|
|
export { getScrollParent };
|