toji/game-shim — pull request #3 by cpearce (2012-05-09 03:26:15+00:00)
Title: Spec compliance and fixes to make it work in Firefox 

Hi, I implemented fullscreen in Firefox, and have done a little work on our pointer lock implementation as well.

Thanks for making this shim! It's just what I've been looking for; I tried to implement something like this myself, but I don't know enough JS to get it working.

I noticed your shim doesn't work properly in Firefox though, because of some misspellings (mostly case sensitivity), so I fixed it.

You were also weren't using document.fullscreenEnabled correctly. You were using it as if it reports whether the document is currently in fullscreen, but fullscreenEnabled is supposed to report whether a fullscreen request in the current context document can be reasonably assumed to succeed (in Firefox this basically returns true when all containing iframes, if any, have the mozallowfullscreen attribute). Admittedly the spec for fullscreenEnabled [1] isn't very clear, but that's what it means.

You also include document.pointerlockEnabled, but this doesn't exist in the current pointer lock spec [2].

So with these changesets, game-shim works correctly in Firefox, and matches the current specifications. Cheers!

[1] http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-document-fullscreenenabled
[2] http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html