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

27 lines
735 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = offsetParent;
var _css = _interopRequireDefault(require("./css"));
var _ownerDocument = _interopRequireDefault(require("./ownerDocument"));
var isHTMLElement = function isHTMLElement(e) {
return !!e && 'offsetParent' in e;
};
function offsetParent(node) {
var doc = (0, _ownerDocument.default)(node);
var parent = node && node.offsetParent;
while (isHTMLElement(parent) && parent.nodeName !== 'HTML' && (0, _css.default)(parent, 'position') === 'static') {
parent = parent.offsetParent;
}
return parent || doc.documentElement;
}
module.exports = exports["default"];