Skip to content

Commit 37e36d4

Browse files
committed
Removed pre-Chrome Edge support, fixed 'window' reference, minor opts
1 parent 2226469 commit 37e36d4

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/library_html5.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ var LibraryHTML5 = {
930930

931931
$screenOrientation: () => {
932932
if (!screen) return undefined;
933-
return screen.orientation || screen.mozOrientation || screen.webkitOrientation || screen.msOrientation;
933+
return screen.orientation || screen.mozOrientation || screen.webkitOrientation;
934934
},
935935

936936
$fillOrientationChangeEventData__deps: ['$screenOrientation'],
@@ -943,28 +943,19 @@ var LibraryHTML5 = {
943943
var orientationIndex = -1;
944944
var orientationAngle = 0;
945945
var screenOrientObj = screenOrientation();
946-
if (screenOrientObj) {
947-
var orientationType;
948-
if (typeof screenOrientObj === 'object') {
949-
orientationType = screenOrientObj.type;
950-
orientationAngle = screenOrientObj.angle;
951-
} else {
952-
// Edge only supports the older string type until 2020 (pre-Chrome)
953-
orientationType = String(screenOrientObj);
954-
}
955-
orientationIndex = orientationsType1.indexOf(orientationType);
956-
if (orientationIndex == -1) {
957-
orientationIndex = orientationsType2.indexOf(orientationType);
946+
if (typeof screenOrientObj === 'object') {
947+
orientationIndex = orientationsType1.indexOf(screenOrientObj.type);
948+
if (orientationIndex < 0) {
949+
orientationIndex = orientationsType2.indexOf(screenOrientObj.type);
958950
}
959-
if (orientationIndex != -1) {
951+
if (orientationIndex < 0) {
960952
orientationIndex = 1 << orientationIndex;
961953
}
954+
orientationAngle = screenOrientObj.angle;
962955
} else {
963956
#if MIN_SAFARI_VERSION < 0x100400
964957
// fallback for Safari earlier than 16.4 (March 2023)
965-
if (window && (window['orientation'] !== undefined)) {
966-
orientationAngle = window['orientation'];
967-
}
958+
orientationAngle = window.orientation;
968959
#endif
969960
}
970961

0 commit comments

Comments
 (0)