Skip to content

Commit 03898e2

Browse files
aleksei-semikozovAleksei Semikozov
andauthored
Popup: remove old safari support (#30129)
Co-authored-by: Aleksei Semikozov <[email protected]>
1 parent 5f56706 commit 03898e2

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

packages/devextreme/js/__internal/ui/popup/m_popup.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import type { dxElementWrapper } from '@js/core/renderer';
1111
import $ from '@js/core/renderer';
1212
import resizeObserverSingleton from '@js/core/resize_observer';
1313
import { EmptyTemplate } from '@js/core/templates/empty_template';
14-
import browser from '@js/core/utils/browser';
1514
import { noop } from '@js/core/utils/common';
1615
import { extend } from '@js/core/utils/extend';
1716
import { camelize } from '@js/core/utils/inflector';
@@ -27,7 +26,6 @@ import {
2726
getWidth,
2827
} from '@js/core/utils/size';
2928
import { isDefined, isObject } from '@js/core/utils/type';
30-
import { compare as compareVersions } from '@js/core/utils/version';
3129
import Button from '@js/ui/button';
3230
import type { dxPopupAnimation, Properties, ToolbarItem } from '@js/ui/popup';
3331
import Resizable from '@js/ui/resizable';
@@ -79,8 +77,9 @@ const BUTTON_TEXT_MODE = 'text';
7977
const BUTTON_CONTAINED_MODE = 'contained';
8078
const BUTTON_OUTLINED_MODE = 'outlined';
8179

82-
const IS_OLD_SAFARI = browser.safari && compareVersions(browser.version, [11]) < 0;
83-
const HEIGHT_STRATEGIES = { static: '', inherit: POPUP_CONTENT_INHERIT_HEIGHT_CLASS, flex: POPUP_CONTENT_FLEX_HEIGHT_CLASS };
80+
const HEIGHT_STRATEGIES = { static: '', inherit: POPUP_CONTENT_INHERIT_HEIGHT_CLASS, flex: POPUP_CONTENT_FLEX_HEIGHT_CLASS } as const;
81+
82+
type HeightStrategiesType = typeof HEIGHT_STRATEGIES[keyof typeof HEIGHT_STRATEGIES];
8483

8584
const getButtonPlace = (name) => {
8685
const device = devices.current();
@@ -889,16 +888,16 @@ class Popup<
889888
this._setHeightClasses(this.$overlayContent(), currentHeightStrategyClass);
890889
}
891890

892-
_heightStrategyChangeOffset(currentHeightStrategyClass, popupVerticalPaddings): number {
891+
_heightStrategyChangeOffset(currentHeightStrategyClass: HeightStrategiesType, popupVerticalPaddings): number {
893892
return currentHeightStrategyClass === HEIGHT_STRATEGIES.flex ? -popupVerticalPaddings : 0;
894893
}
895894

896-
_chooseHeightStrategy(overlayContent: HTMLElement): string {
895+
_chooseHeightStrategy(overlayContent: HTMLElement): HeightStrategiesType {
897896
const isAutoWidth = overlayContent.style.width === 'auto' || overlayContent.style.width === '';
898-
let currentHeightStrategyClass = HEIGHT_STRATEGIES.static;
897+
let currentHeightStrategyClass: HeightStrategiesType = HEIGHT_STRATEGIES.static;
899898

900899
if (this._isAutoHeight() && this.option('autoResizeEnabled')) {
901-
if (isAutoWidth || IS_OLD_SAFARI) {
900+
if (isAutoWidth) {
902901
currentHeightStrategyClass = HEIGHT_STRATEGIES.inherit;
903902
} else {
904903
currentHeightStrategyClass = HEIGHT_STRATEGIES.flex;
@@ -908,7 +907,7 @@ class Popup<
908907
return currentHeightStrategyClass;
909908
}
910909

911-
_getHeightCssStyles(currentHeightStrategyClass, overlayContent) {
910+
_getHeightCssStyles(currentHeightStrategyClass: HeightStrategiesType, overlayContent) {
912911
let cssStyles = {};
913912
const contentMaxHeight = this._getOptionValue('maxHeight', overlayContent);
914913
const contentMinHeight = this._getOptionValue('minHeight', overlayContent);

packages/devextreme/testing/tests/DevExpress.ui.widgets/popup.tests.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,13 +1064,8 @@ QUnit.module('options changed callbacks', {
10641064

10651065
const $popup = popup.$content().parent();
10661066

1067-
if(IS_OLD_SAFARI) {
1068-
assert.notOk($popup.hasClass(POPUP_CONTENT_FLEX_HEIGHT_CLASS), 'has no POPUP_CONTENT_FLEX_HEIGHT_CLASS with fixed width for old safari');
1069-
assert.ok($popup.hasClass(POPUP_CONTENT_INHERIT_HEIGHT_CLASS), 'has POPUP_CONTENT_INHERIT_HEIGHT_CLASS with fixed width for old safari');
1070-
} else {
1071-
assert.ok($popup.hasClass(POPUP_CONTENT_FLEX_HEIGHT_CLASS), 'has POPUP_CONTENT_FLEX_HEIGHT_CLASS with fixed width');
1072-
assert.notOk($popup.hasClass(POPUP_CONTENT_INHERIT_HEIGHT_CLASS), 'has no POPUP_CONTENT_INHERIT_HEIGHT_CLASS with fixed width');
1073-
}
1067+
assert.ok($popup.hasClass(POPUP_CONTENT_FLEX_HEIGHT_CLASS), 'has POPUP_CONTENT_FLEX_HEIGHT_CLASS with fixed width');
1068+
assert.notOk($popup.hasClass(POPUP_CONTENT_INHERIT_HEIGHT_CLASS), 'has no POPUP_CONTENT_INHERIT_HEIGHT_CLASS with fixed width');
10741069

10751070
popup.option('width', 'auto');
10761071

0 commit comments

Comments
 (0)