GoScrobble/web/node_modules/react-overlays/cjs/isOverflowing.js

27 lines
914 B
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = isOverflowing;
var _isWindow = _interopRequireDefault(require("dom-helpers/isWindow"));
var _ownerDocument = _interopRequireDefault(require("dom-helpers/ownerDocument"));
function isBody(node) {
return node && node.tagName.toLowerCase() === 'body';
}
function bodyIsOverflowing(node) {
var doc = (0, _isWindow["default"])(node) ? (0, _ownerDocument["default"])() : (0, _ownerDocument["default"])(node);
var win = (0, _isWindow["default"])(node) || doc.defaultView;
return doc.body.clientWidth < win.innerWidth;
}
function isOverflowing(container) {
var win = (0, _isWindow["default"])(container);
return win || isBody(container) ? bodyIsOverflowing(container) : container.scrollHeight > container.clientHeight;
}
module.exports = exports.default;