[whatwg] Fullscreen Update

Mikko Rantalainen mikko.rantalainen at peda.net
Thu Oct 20 05:27:44 PDT 2011


2011-10-19 17:45 EEST: Glenn Maynard:
> b.onclick = function(e) {
>     if(document.fullscreen)
>         document.exitFullscreen();
>     else
>         gameDiv.enterFullScreen();
> }

In fact, the most obvious code should be

b.onclick = function(e) {
    if(gameDiv.fullscreen)
        gameDiv.exitFullscreen();
    else
        gameDiv.enterFullScreen();
}

> If F11-fullscreen sets document.fullscreen, this breaks; enterFullScreen
> would never be called. 

Yes. If the web developer is going to fullscreen a single element, he
should test if that element is fullscreen instead of testing if the
whole document is fullscreen, IMHO.

-- 
Mikko



More information about the whatwg mailing list