Skip to content

Commit

Permalink
Fix fullscreen polyfill for MSIE 11 (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross-cz authored and joeyparrish committed May 8, 2017
1 parent 52ed12c commit 74e21ea
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/polyfill/fullscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,18 @@ shaka.polyfill.Fullscreen.install = function() {
* @private
*/
shaka.polyfill.Fullscreen.proxyEvent_ = function(event) {
var type2 = event.type.replace(/^(webkit|moz|MS)/, '').toLowerCase();
var event2 = new Event(type2, /** @type {EventInit} */(event));
event.target.dispatchEvent(event2);
var eventType = event.type.replace(/^(webkit|moz|MS)/, '').toLowerCase();

var newEvent;
// IE 11 does not have an Event constructor
if (typeof(Event) === 'function') {
newEvent = new Event(eventType, /** @type {EventInit} */(event));
} else {
newEvent = document.createEvent('Event');
newEvent.initEvent(eventType, event.bubbles, event.cancelable);
}

event.target.dispatchEvent(newEvent);
};


Expand Down

0 comments on commit 74e21ea

Please sign in to comment.