[whatwg] Fullscreen Update

On Wed, 19 Oct 2011 16:45:34 +0200, Glenn Maynard <glenn at zewt.org> wrote:

> On Wed, Oct 19, 2011 at 12:40 AM, Anne van Kesteren  
> <annevk at opera.com>wrote:
>
>> 1) How much should UI-based and API-based fullscreen interact? To me it
>> seems nice if pressing F11 would also give you fullscreenchange events  
>> and
>> that Document.fullscreen would yield true. Why would you not want to  
>> give
>> the same presentation via native activation and API-based activation? Of
>> course when you activate it UI-wise, navigation should not exit it.
>
>
> The most obvious way to write a fullscreen button is:
>
> b.onclick = function(e) {
>     if(document.fullscreen)
>         document.exitFullscreen();
>     else
>         gameDiv.enterFullScreen();
> }
>
> If F11-fullscreen sets document.fullscreen, this breaks; enterFullScreen
> would never be called.  This could be dealt with, of course (check
> document.fullscreenElement == gameDiv instead), but it's a corner case  
> that
> people aren't going to test.
>

I think you just solved your own issue :) Your if check is wrong given  
your use case. Besides, if the developer failed to test, it would just  
require an extra click.

Received on Wednesday, 19 October 2011 08:00:19 UTC