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

17 lines
586 B
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
import isWindow from 'dom-helpers/isWindow';
import ownerDocument from 'dom-helpers/ownerDocument';
function isBody(node) {
return node && node.tagName.toLowerCase() === 'body';
}
function bodyIsOverflowing(node) {
var doc = isWindow(node) ? ownerDocument() : ownerDocument(node);
var win = isWindow(node) || doc.defaultView;
return doc.body.clientWidth < win.innerWidth;
}
export default function isOverflowing(container) {
var win = isWindow(container);
return win || isBody(container) ? bodyIsOverflowing(container) : container.scrollHeight > container.clientHeight;
}