@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
31 lines • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// (C) 2007-2019 GoodData Corporation
var once = require("lodash/once");
var getScrollbarWidthBody = function () {
var outer = document.createElement("div");
outer.style.visibility = "hidden";
outer.style.width = "100px";
document.body.appendChild(outer);
var widthNoScroll = outer.offsetWidth;
// force scrollbars
outer.style.overflow = "scroll";
// add inner div
var inner = document.createElement("div");
inner.style.width = "100%";
outer.appendChild(inner);
var widthWithScroll = inner.offsetWidth;
// remove divs
outer.parentNode.removeChild(outer);
return widthNoScroll - widthWithScroll;
};
/**
* Returns the current actual scrollbar width.
* For performance reasons this is memoized as the value is highly unlikely to change
*/
exports.getScrollbarWidth = once(getScrollbarWidthBody);
exports.isCssMultiLineTruncationSupported = function () {
// support -webkit-line-clamp
return "webkitLineClamp" in document.body.style;
};
//# sourceMappingURL=domUtils.js.map