Skip to content

Commit

Permalink
fix(fs): fix isFullscreen check for spec-api
Browse files Browse the repository at this point in the history
For non-prefixed APIs, check directly against the fullscreen element
rather than using the cached value.

Fixes #5814.
  • Loading branch information
gkatsev committed May 24, 2019
1 parent cd6be5b commit 700e58d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,21 @@ class Player extends Component {
this.toggleFullscreenClass_();
return;
}

if (prefixedFS) {
const fsApi = FullscreenApi;
const el = this.el();
let isFs = document[fsApi.fullscreenElement] === el;

if (!isFs && el.matches) {
isFs = el.matches(':' + fsApi.fullscreen);
} else if (!isFs && el.msMatchesSelector) {
isFs = el.msMatchesSelector(':' + fsApi.fullscreen);
}

return isFs;
}

return !!this.isFullscreen_;
}

Expand Down

0 comments on commit 700e58d

Please sign in to comment.