closure-library
closure-library copied to clipboard
goog.dom.fullscreen/isFullScreen test insufficient on webkit
Description: The function goog.dom.fullscreen.isSupported lacks the test of webkitFullScreenEnabled.
Testcase: Put a html site inside an iframe and don't allow fullscreen. Then call the function inside the iframe. It should return false, as document.webkitFullScreenEnabled returns false.
Solution: Change the function to:
goog.dom.fullscreen.isSupported = function(opt_domHelper) {
var doc = goog.dom.fullscreen.getDocument_(opt_domHelper);
var body = doc.body;
return !!(
(body.webkitRequestFullscreen && doc.webkitFullScreenEnabled) ||
(body.mozRequestFullScreen && doc.mozFullScreenEnabled) ||
(body.msRequestFullscreen && doc.msFullscreenEnabled) ||
(body.requestFullscreen && doc.fullscreenEnabled));
};