neovov / Fullscreen-API-Polyfill

MIT License
64 stars 17 forks source link

Current fullscreen element is null in webkitfullscreenchange #23

Closed mbixby closed 8 years ago

mbixby commented 8 years ago

I was investigating an issue in Safari (9.1.1, OSX 10.11.5) where document.fullscreenElement stayed null even though document.webkitFullscreenElement was correctly set to the fullscreen element.

So I dropped a debugger statement into the handleChange (webkitfullscreenchange) method and suddenly it worked – document.fullscreenElement behaved correctly.

I replaced the debugger statement with console.log and... it broke again. document.webkitFullscreenElement was actually null in webkitfullscreenchange handler. When I later poked the property from the console, it was correct.

...This looks like a nice heisenbug unless I'm going crazy. Some screenshots below as proof. I didn't dive in deeper, I think I'll just submit some PR with a hotfix.

screen shot 2016-07-06 at 7 11 28 pm screen shot 2016-07-06 at 7 11 04 pm screen shot 2016-07-06 at 7 18 30 pm
mbixby commented 8 years ago

Can you actually please add .editorconfig before I make any changes? There's something exotic about the source files and Sublime and git diff can't deal with it.

neovov commented 8 years ago

Hi @mbixby,

I finally got some time to look at your issue. I have only Safari 10 and it seems to work correctly (document.webkitCurrentFullScreenElement is set in handleChange). Would you confirm the issue is still going on in Safari 9 ? Can you try with Safari 10 ?

Thanks, cheers :beers: