UNPKG

914 BJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5exports.__esModule = true;
6exports["default"] = isOverflowing;
7
8var _isWindow = _interopRequireDefault(require("dom-helpers/isWindow"));
9
10var _ownerDocument = _interopRequireDefault(require("dom-helpers/ownerDocument"));
11
12function isBody(node) {
13 return node && node.tagName.toLowerCase() === 'body';
14}
15
16function bodyIsOverflowing(node) {
17 var doc = (0, _isWindow["default"])(node) ? (0, _ownerDocument["default"])() : (0, _ownerDocument["default"])(node);
18 var win = (0, _isWindow["default"])(node) || doc.defaultView;
19 return doc.body.clientWidth < win.innerWidth;
20}
21
22function isOverflowing(container) {
23 var win = (0, _isWindow["default"])(container);
24 return win || isBody(container) ? bodyIsOverflowing(container) : container.scrollHeight > container.clientHeight;
25}
26
27module.exports = exports.default;
\No newline at end of file