katoikia-app/web-ui/web-react/node_modules/dom-helpers/esm/offsetParent.js

17 lines
465 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
import css from './css';
import ownerDocument from './ownerDocument';
var isHTMLElement = function isHTMLElement(e) {
return !!e && 'offsetParent' in e;
};
export default function offsetParent(node) {
var doc = ownerDocument(node);
var parent = node && node.offsetParent;
while (isHTMLElement(parent) && parent.nodeName !== 'HTML' && css(parent, 'position') === 'static') {
parent = parent.offsetParent;
}
return parent || doc.documentElement;
}