UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

25 lines (24 loc) 944 B
/** * DevExtreme (esm/ui/pivot_grid/utils/calculate_scrollbar_width.js) * Version: 21.2.4 * Build date: Mon Dec 06 2021 * * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import domAdapter from "../../../core/dom_adapter"; import callOnce from "../../../core/utils/call_once"; import { getScrollbarWidth } from "./get_scrollbar_width"; var calculateScrollbarWidth = callOnce((function() { var document = domAdapter.getDocument(); document.body.insertAdjacentHTML("beforeend", "<div style='position: absolute; overflow: scroll; width: 100px; height: 100px; top: -9999;'></div>"); var scrollbar = document.body.lastElementChild; var scrollbarWidth = getScrollbarWidth(scrollbar); document.body.removeChild(scrollbar); return scrollbarWidth })); export { calculateScrollbarWidth };