aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Hagemeister <marvin@marvinhagemeister.de>2016-01-27 21:27:58 +0100
committerMarvin Hagemeister <marvin@marvinhagemeister.de>2016-01-27 21:27:58 +0100
commit31a0eb8d1472ff792fe64cb75e81de16b7a5ea0b (patch)
tree4b787c4dc476247400faef8fc5830db27d22e66a
parentb8b611fbb61be016ab23d1a71225f1baf2df0a91 (diff)
downloadplyr-31a0eb8d1472ff792fe64cb75e81de16b7a5ea0b.tar.lz
plyr-31a0eb8d1472ff792fe64cb75e81de16b7a5ea0b.tar.xz
plyr-31a0eb8d1472ff792fe64cb75e81de16b7a5ea0b.zip
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)
-rw-r--r--src/js/plyr.js2
1 files changed, 1 insertions, 1 deletions
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*/