Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add webkitCurrentFullScreenElement #5

Merged
merged 1 commit into from

2 participants

@ssssssssssss

Use webkitCurrentFullScreenElement if there is no native fullscreenElement support.

@toji toji merged commit 2a4b8e7 into toji:master
@toji
Owner

Thank you! Didn't realize that webkit had diverged on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 23, 2012
  1. @ssssssssssss
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 6 deletions.
  1. +8 −6 game-shim.js
View
14 game-shim.js
@@ -127,11 +127,13 @@
if(!document.hasOwnProperty("fullscreenElement")) {
getter = (function() {
// These are the functions that match the spec, and should be preferred
- if("webkitFullscreenElement" in document) {
- return function() { return document.webkitFullscreenElement; };
- }
- if("mozFullScreenElement" in document) {
- return function() { return document.mozFullScreenElement; };
+ var i=0, name=["webkitCurrentFullScreenElement", "webkitFullscreenElement", "mozFullScreenElement"];
+ for (; i<name.length; i++)
+ {
+ if (name[i] in document)
+ {
+ return function() { return document[name[i]]; };
+ }
}
return function() { return null; }; // not supported
})();
@@ -351,4 +353,4 @@
})();
}
-})((typeof(exports) != 'undefined') ? global : window); // Account for CommonJS environments
+})((typeof(exports) != 'undefined') ? global : window); // Account for CommonJS environments
Something went wrong with that request. Please try again.