-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #35 - Prevent TypeError: Document not active
- Loading branch information
Showing
1 changed file
with
13 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* @preserve jquery.fullscreen 1.1.5 | ||
* @preserve jquery.fullscreen 1.1.6 | ||
* https://github.com/kayahr/jquery-fullscreen-plugin | ||
* Copyright (C) 2012-2013 Klaus Reimer <[email protected]> | ||
* Licensed under the MIT license | ||
|
@@ -61,10 +61,7 @@ function fullScreen(state) | |
} | ||
|
||
// Check fullscreen state | ||
state = !!doc["fullscreenElement"] | ||
|| !!doc["msFullscreenElement"] | ||
|| !!doc["webkitIsFullScreen"] | ||
|| !!doc["mozFullScreen"]; | ||
state = fullScreenState(doc); | ||
if (!state) return state; | ||
|
||
// Return current fullscreen element or "true" if browser doesn't | ||
|
@@ -100,11 +97,21 @@ function fullScreen(state) | |
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"]) | ||
|| (/** @type {?Function} */ doc["msExitFullscreen"]) | ||
|| (/** @type {?Function} */ doc["mozCancelFullScreen"]); | ||
if (func) func.call(doc); | ||
if (func && fullScreenState(doc)) func.call(doc); | ||
return this; | ||
} | ||
} | ||
|
||
/** | ||
* Check fullscreen state | ||
* | ||
* @param {Document} doc The content document | ||
* @return {Boolean} | ||
*/ | ||
function fullScreenState(doc) { | ||
return !!(doc["fullscreenElement"] || doc["msFullscreenElement"] || doc["webkitIsFullScreen"] || doc["mozFullScreen"]); | ||
} | ||
|
||
/** | ||
* Toggles the fullscreen mode. | ||
* | ||
|