File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -61,10 +61,7 @@ function fullScreen(state)
6161 }
6262
6363 // Check fullscreen state
64- state = ! ! doc [ "fullscreenElement" ]
65- || ! ! doc [ "msFullscreenElement" ]
66- || ! ! doc [ "webkitIsFullScreen" ]
67- || ! ! doc [ "mozFullScreen" ] ;
64+ state = fullScreenState ( doc ) ;
6865 if ( ! state ) return state ;
6966
7067 // Return current fullscreen element or "true" if browser doesn't
@@ -100,11 +97,21 @@ function fullScreen(state)
10097 || ( /** @type {?Function } */ doc [ "webkitCancelFullScreen" ] )
10198 || ( /** @type {?Function } */ doc [ "msExitFullscreen" ] )
10299 || ( /** @type {?Function } */ doc [ "mozCancelFullScreen" ] ) ;
103- if ( func ) func . call ( doc ) ;
100+ if ( func && fullScreenState ( doc ) ) func . call ( doc ) ;
104101 return this ;
105102 }
106103}
107104
105+ /**
106+ * Check fullscreen state
107+ *
108+ * @param {Document } doc The content document
109+ * @return {Boolean }
110+ */
111+ function fullScreenState ( doc ) {
112+ return ! ! ( doc [ "fullscreenElement" ] || doc [ "msFullscreenElement" ] || doc [ "webkitIsFullScreen" ] || doc [ "mozFullScreen" ] ) ;
113+ }
114+
108115/**
109116 * Toggles the fullscreen mode.
110117 *
You can’t perform that action at this time.
0 commit comments