Initial commit
This commit is contained in:
39
node_modules/react-overlays/lib/utils/isOverflowing.js
generated
vendored
Normal file
39
node_modules/react-overlays/lib/utils/isOverflowing.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = isOverflowing;
|
||||
|
||||
var _isWindow = require('dom-helpers/query/isWindow');
|
||||
|
||||
var _isWindow2 = _interopRequireDefault(_isWindow);
|
||||
|
||||
var _ownerDocument = require('dom-helpers/ownerDocument');
|
||||
|
||||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isBody(node) {
|
||||
return node && node.tagName.toLowerCase() === 'body';
|
||||
}
|
||||
|
||||
function bodyIsOverflowing(node) {
|
||||
var doc = (0, _ownerDocument2.default)(node);
|
||||
var win = (0, _isWindow2.default)(doc);
|
||||
var fullWidth = win.innerWidth;
|
||||
|
||||
// Support: ie8, no innerWidth
|
||||
if (!fullWidth) {
|
||||
var documentElementRect = doc.documentElement.getBoundingClientRect();
|
||||
fullWidth = documentElementRect.right - Math.abs(documentElementRect.left);
|
||||
}
|
||||
|
||||
return doc.body.clientWidth < fullWidth;
|
||||
}
|
||||
|
||||
function isOverflowing(container) {
|
||||
var win = (0, _isWindow2.default)(container);
|
||||
|
||||
return win || isBody(container) ? bodyIsOverflowing(container) : container.scrollHeight > container.clientHeight;
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
Reference in New Issue
Block a user