Skip to content

Commit e71cb04

Browse files
authored
fix(OpenUI5Support): css variables detection (#13465)
1 parent a77b76d commit e71cb04

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

packages/base/src/features/OpenUI5Support.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const OPENUI5_POLLING_INTERVAL = 100;
7777
class OpenUI5Support {
7878
static enablePolling = false; // set to true for old OpenUI5 versions
7979

80-
static isAtLeastVersion116() {
80+
static isAtLeastVersion(minor: number) {
8181
if (!window.sap.ui!.version) {
8282
return true; // sap.ui.version will be removed in newer OpenUI5 versions
8383
}
@@ -86,7 +86,7 @@ class OpenUI5Support {
8686
if (!parts || parts.length < 2) {
8787
return false;
8888
}
89-
return parseInt(parts[0]) > 1 || parseInt(parts[1]) >= 116;
89+
return parseInt(parts[0]) > 1 || parseInt(parts[1]) >= minor;
9090
}
9191

9292
static isOpenUI5Detected() {
@@ -128,7 +128,7 @@ class OpenUI5Support {
128128
window.sap.ui.require(["sap/ui/core/Core"], async (Core: OpenUI5Core) => {
129129
const callback = () => {
130130
let deps: Array<string> = ["sap/ui/core/Popup", "sap/m/Dialog", "sap/ui/core/Patcher", "sap/ui/core/LocaleData"];
131-
if (OpenUI5Support.isAtLeastVersion116()) { // for versions since 1.116.0 and onward, use the modular core
131+
if (OpenUI5Support.isAtLeastVersion(116)) { // for versions since 1.116.0 and onward, use the modular core
132132
deps = [
133133
...deps,
134134
"sap/base/i18n/Formatting",
@@ -144,7 +144,7 @@ class OpenUI5Support {
144144
resolve();
145145
});
146146
};
147-
if (OpenUI5Support.isAtLeastVersion116()) {
147+
if (OpenUI5Support.isAtLeastVersion(116)) {
148148
await Core.ready();
149149
callback();
150150
} else {
@@ -162,7 +162,7 @@ class OpenUI5Support {
162162
return {};
163163
}
164164

165-
if (OpenUI5Support.isAtLeastVersion116()) {
165+
if (OpenUI5Support.isAtLeastVersion(116)) {
166166
const ControlBehavior = window.sap.ui.require("sap/ui/core/ControlBehavior") as ControlBehavior;
167167
const Localization = window.sap.ui.require("sap/base/i18n/Localization") as Localization;
168168
const Theming = window.sap.ui.require("sap/ui/core/Theming") as Theming;
@@ -211,7 +211,7 @@ class OpenUI5Support {
211211

212212
const LocaleData = window.sap.ui.require("sap/ui/core/LocaleData") as LocaleData;
213213

214-
if (OpenUI5Support.isAtLeastVersion116()) {
214+
if (OpenUI5Support.isAtLeastVersion(116)) {
215215
const Localization = window.sap.ui.require("sap/base/i18n/Localization") as Localization;
216216
return LocaleData.getInstance(Localization.getLanguageTag())._get();
217217
}
@@ -222,7 +222,7 @@ class OpenUI5Support {
222222
}
223223

224224
static _listenForThemeChange() {
225-
if (OpenUI5Support.isAtLeastVersion116()) {
225+
if (OpenUI5Support.isAtLeastVersion(116)) {
226226
const Theming: Theming = window.sap.ui.require("sap/ui/core/Theming");
227227
Theming.attachApplied(() => {
228228
setTheme(Theming.getTheme());
@@ -256,7 +256,11 @@ class OpenUI5Support {
256256
}
257257

258258
// The file name is "css_variables.css" until 1.127 and "library.css" from 1.127 onwards
259-
return !!link.href.match(/\/css(-|_)variables\.css/) || !!link.href.match(/\/library\.css/);
259+
if (OpenUI5Support.isAtLeastVersion(127)) {
260+
return !!link.href.match(/\/css(-|_)variables\.css/) || !!link.href.match(/\/library\.css/);
261+
}
262+
263+
return !!link.href.match(/\/css(-|_)variables\.css/);
260264
}
261265

262266
static addOpenedPopup(popupInfo: PopupInfo) {

0 commit comments

Comments
 (0)