mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
17 lines
586 B
JavaScript
17 lines
586 B
JavaScript
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;
|
|
} |