@@ -53,21 +53,31 @@ function fullScreen(state)
53
53
// When fullscreen mode is not supported then return null
54
54
if ( ! ( ( /** @type {?Function } */ doc [ "cancelFullScreen" ] )
55
55
|| ( /** @type {?Function } */ doc [ "webkitCancelFullScreen" ] )
56
+ || ( /** @type {?Function } */ doc [ "msExitFullscreen" ] )
56
57
|| ( /** @type {?Function } */ doc [ "mozCancelFullScreen" ] ) ) )
57
58
{
58
59
return null ;
59
60
}
60
61
62
+ // In theory this should not be necessary but looks like IE11
63
+ // has a bug here. msFullscreenEnabled always returns true. So
64
+ // this workaround also checks if msFullScreenElement is null and
65
+ // returns false in this case
66
+ if ( doc [ "msFullscreenEnabled" ] && ! doc [ "msFullscreenElement" ] )
67
+ return false ;
68
+
61
69
// Check fullscreen state
62
70
state = ! ! doc [ "fullScreen" ]
63
71
|| ! ! doc [ "webkitIsFullScreen" ]
72
+ || ! ! doc [ "msFullscreenEnabled" ]
64
73
|| ! ! doc [ "mozFullScreen" ] ;
65
74
if ( ! state ) return state ;
66
75
67
76
// Return current fullscreen element or "true" if browser doesn't
68
77
// support this
69
78
return ( /** @type {?Element } */ doc [ "fullScreenElement" ] )
70
79
|| ( /** @type {?Element } */ doc [ "webkitCurrentFullScreenElement" ] )
80
+ || ( /** @type {?Element } */ doc [ "msFullscreenElement" ] )
71
81
|| ( /** @type {?Element } */ doc [ "mozFullScreenElement" ] )
72
82
|| state ;
73
83
}
@@ -78,6 +88,7 @@ function fullScreen(state)
78
88
// Enter fullscreen
79
89
func = ( /** @type {?Function } */ e [ "requestFullScreen" ] )
80
90
|| ( /** @type {?Function } */ e [ "webkitRequestFullScreen" ] )
91
+ || ( /** @type {?Function } */ e [ "msRequestFullscreen" ] )
81
92
|| ( /** @type {?Function } */ e [ "mozRequestFullScreen" ] ) ;
82
93
if ( func )
83
94
{
@@ -93,6 +104,7 @@ function fullScreen(state)
93
104
// Exit fullscreen
94
105
func = ( /** @type {?Function } */ doc [ "cancelFullScreen" ] )
95
106
|| ( /** @type {?Function } */ doc [ "webkitCancelFullScreen" ] )
107
+ || ( /** @type {?Function } */ doc [ "msExitFullscreen" ] )
96
108
|| ( /** @type {?Function } */ doc [ "mozCancelFullScreen" ] ) ;
97
109
if ( func ) func . call ( doc ) ;
98
110
return this ;
@@ -150,6 +162,11 @@ function installFullScreenHandlers()
150
162
change = "webkitfullscreenchange" ;
151
163
error = "webkitfullscreenerror" ;
152
164
}
165
+ else if ( e [ "msExitFullscreen" ] )
166
+ {
167
+ change = "MSFullscreenChange" ;
168
+ error = "MSFullscreenError" ;
169
+ }
153
170
else if ( e [ "mozCancelFullScreen" ] )
154
171
{
155
172
change = "mozfullscreenchange" ;
0 commit comments