UNPKG

@progress/kendo-vue-common

Version:

Kendo UI for Vue Common Utilities package

36 lines (35 loc) 2.01 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ const c = () => typeof document != "undefined" ? document : {}, l = () => c().createElement; class d { constructor() { this.cachedScrollbarWidth = null, this.cachedRtlScrollLeft = null; } get scrollbarWidth() { if (this.cachedScrollbarWidth === null && l()) { this.cachedPixelRatio = window.devicePixelRatio || 1; const e = document.createElement("div"), t = document.createElement("div"); e.style.overflow = "scroll", e.style.overflowX = "hidden", e.style.zoom = "1", e.style.clear = "both", e.style.display = "block", e.style.width = "100px", e.style.visibility = "hidden", t.style.width = "100%", t.style.display = "block", e.appendChild(t), document.body.appendChild(e), this.cachedScrollbarWidth = e.getBoundingClientRect().width - t.getBoundingClientRect().width, document.body.removeChild(e); } return this.cachedScrollbarWidth; } get rtlScrollLeft() { if (this.cachedRtlScrollLeft === null && l()) { const e = document.createElement("div"); e.style.direction = "rtl", e.style.display = "block", e.style.clear = "both", e.style.width = "100px", e.style.visibility = "hidden", e.style.position = "absolute", e.style.left = "-10000px", e.style.overflow = "scroll", e.style.zoom = "1"; const t = document.createElement("div"); t.style.width = "200px", t.style.height = "1px", e.append(t), document.body.appendChild(e); const o = e.scrollLeft; e.scrollLeft = -1, this.cachedRtlScrollLeft = e.scrollLeft < 0 ? e.scrollLeft : o, document.body.removeChild(e); } return this.cachedRtlScrollLeft; } } export { d as BrowserSupportService };