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:
parent
3553a451d8
commit
b180a4f4ba
|
|
@ -1335,7 +1335,7 @@ const UI = {
|
|||
|
||||
let brokenScrollbars = false;
|
||||
|
||||
if (!hasScrollbarGutter) {
|
||||
if (!hasScrollbarGutter()) {
|
||||
if (isIOS() || isAndroid() || isMac() || isChromeOS()) {
|
||||
brokenScrollbars = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ try {
|
|||
|
||||
export const supportsCursorURIs = _supportsCursorURIs;
|
||||
|
||||
export const hasScrollbarGutter = () => {
|
||||
let _hasScrollbarGutter = true;
|
||||
try {
|
||||
// Create invisible container
|
||||
|
|
@ -68,7 +69,8 @@ try {
|
|||
} catch (exc) {
|
||||
Log.Error("Scrollbar test exception: " + exc);
|
||||
}
|
||||
export const hasScrollbarGutter = _hasScrollbarGutter;
|
||||
return _hasScrollbarGutter;
|
||||
};
|
||||
|
||||
/*
|
||||
* The functions for detection of platforms and browsers below are exported
|
||||
|
|
|
|||
Loading…
Reference in New Issue