From 31a0eb8d1472ff792fe64cb75e81de16b7a5ea0b Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 27 Jan 2016 21:27:58 +0100 Subject: [PATCH] Get the proper window reference on initialization. The previous code assumed that `this` points to the browsers window object, which is not the case when using a module bundler. So we check for the variable `window` first, before falling back to `this`. (taken from jQuery's codebase) --- src/js/plyr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index 76623068..2cee1210 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -21,7 +21,7 @@ // Browser globals (root is window) root.plyr = factory(root, document); } -}(this, function(window, document) { +}(typeof window !== 'undefined' ? window : this, function(window, document) { 'use strict'; /*global YT,$f*/