[whatwg/fullscreen] Consider adding Document.fullscreen property (#38)

I'm not quite sure whether this existed in the spec, but it seems all implementations currently have some sort of prefixed property for this function. Gecko has `mozFullScreen` and WebKit/Blink has `webkitIsFullScreen`, so it's probably worth adding it.

Today I received another report of regression from unprefixing Fullscreen API, which is because of relying on unprefixed `Document.fullscreen` property.

Here is [a test page](https://www.strava.com/activities/561308877/). If you try to fullscreen the map by the fullscreen button on the right-top corner of the map, you'll see broken fullscreen page on Firefox 47+ (I haven't tested Edge because I'm not on my Windows laptop at this moment) comparing to Firefox 46 and Chrome. (Note, you may need to create an account to see the fullscreen button.)

What happens there is, they have kind of the following code:
```javascript
document.addEventListener('fullscreenchange', function () {
  return document.fullscreen ? enteredFullscreen() : exitedFullscreen();
});
document.addEventListener('mozfullscreenchange', function () {
  return document.mozFullScreen ? enteredFullscreen() : exitedFullscreen();
});
document.addEventListener('webkitfullscreenchange', function () {
  return document.webkitIsFullScreen ? enteredFullscreen() : exitedFullscreen();
});
```
and since we don't have `Document.fullscreen`, the page thinks the `fullscreenchange` event is for exiting fullscreen.

Not sure how widespread is this kind of code, but I guess web developers may want to see this boolean property anyway. (And it's probably need to have a dummy setter as well, like what we want for `fullscreenElement` and `fullscreenEnabled` in #2.)

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fullscreen/issues/38

Received on Sunday, 1 May 2016 00:21:09 UTC