Refactor hasScrollbarGutter into a function

the code to determine hasScrollbarGutter can run while the document.body is not loaded yet.
setting it as a function will trigger it when the actual UI is loaded, and document.body should exist.
This commit is contained in:
Ron Lavi 2022-12-25 22:21:16 +02:00
parent 3553a451d8
commit b180a4f4ba
2 changed files with 23 additions and 21 deletions

View File

@ -1335,7 +1335,7 @@ const UI = {
let brokenScrollbars = false; let brokenScrollbars = false;
if (!hasScrollbarGutter) { if (!hasScrollbarGutter()) {
if (isIOS() || isAndroid() || isMac() || isChromeOS()) { if (isIOS() || isAndroid() || isMac() || isChromeOS()) {
brokenScrollbars = true; brokenScrollbars = true;
} }

View File

@ -45,6 +45,7 @@ try {
export const supportsCursorURIs = _supportsCursorURIs; export const supportsCursorURIs = _supportsCursorURIs;
export const hasScrollbarGutter = () => {
let _hasScrollbarGutter = true; let _hasScrollbarGutter = true;
try { try {
// Create invisible container // Create invisible container
@ -68,7 +69,8 @@ try {
} catch (exc) { } catch (exc) {
Log.Error("Scrollbar test exception: " + exc); Log.Error("Scrollbar test exception: " + exc);
} }
export const hasScrollbarGutter = _hasScrollbarGutter; return _hasScrollbarGutter;
};
/* /*
* The functions for detection of platforms and browsers below are exported * The functions for detection of platforms and browsers below are exported