@@ -249,6 +249,13 @@ var LibraryHTML5 = {
249
249
} ,
250
250
} ,
251
251
252
+ $getFullscreenElement__internal : true ,
253
+ $getFullscreenElement ( ) {
254
+ return document . fullscreenElement || document . mozFullScreenElement ||
255
+ document . webkitFullscreenElement || document . webkitCurrentFullScreenElement ||
256
+ document . msFullscreenElement ;
257
+ } ,
258
+
252
259
$registerKeyEventCallback__noleakcheck: true ,
253
260
$registerKeyEventCallback__deps : [ '$JSEvents' , '$findEventTarget' , '$stringToUTF8' , 'malloc' ] ,
254
261
$registerKeyEventCallback : ( target , userData , useCapture , callbackfunc , eventTypeId , eventTypeString , targetThread ) = > {
@@ -990,9 +997,9 @@ var LibraryHTML5 = {
990
997
return { { { cDefs . EMSCRIPTEN_RESULT_SUCCESS } } } ;
991
998
} ,
992
999
993
- $fillFullscreenChangeEventData__deps : [ '$JSEvents' , '$stringToUTF8' ] ,
1000
+ $fillFullscreenChangeEventData__deps : [ '$JSEvents' , '$stringToUTF8' , '$getFullscreenElement' ] ,
994
1001
$fillFullscreenChangeEventData : ( eventStruct ) => {
995
- var fullscreenElement = document . fullscreenElement || document . mozFullScreenElement || document . webkitFullscreenElement || document . msFullscreenElement ;
1002
+ var fullscreenElement = getFullscreenElement ( ) ;
996
1003
var isFullscreen = ! ! fullscreenElement ;
997
1004
#if ! SAFE_HEAP
998
1005
// Assigning a boolean to HEAP32 with expected type coercion.
@@ -1204,15 +1211,7 @@ var LibraryHTML5 = {
1204
1211
var oldImageRendering = canvas . style . imageRendering ;
1205
1212
1206
1213
function restoreOldStyle ( ) {
1207
- var fullscreenElement = document . fullscreenElement
1208
- #if MIN_FIREFOX_VERSION <= 63 // https://caniuse.com/#feat=mdn-api_documentorshadowroot_fullscreenelement
1209
- || document . mozFullScreenElement
1210
- #endif
1211
- #if MIN_CHROME_VERSION != TARGET_NOT_SUPPORTED || MIN_SAFARI_VERSION != TARGET_NOT_SUPPORTED // https://caniuse.com/#feat=mdn-api_documentorshadowroot_fullscreenelement
1212
- || document . webkitFullscreenElement
1213
- #endif
1214
- ;
1215
- if ( ! fullscreenElement ) {
1214
+ if ( ! getFullscreenElement ( ) ) {
1216
1215
document . removeEventListener ( 'fullscreenchange' , restoreOldStyle ) ;
1217
1216
1218
1217
#if MIN_FIREFOX_VERSION <= 63 // https://caniuse.com/#feat=mdn-api_element_fullscreenchange_event
0 commit comments