diff options
author | Marvin Hagemeister <marvin@marvinhagemeister.de> | 2016-01-27 21:27:58 +0100 |
---|---|---|
committer | Marvin Hagemeister <marvin@marvinhagemeister.de> | 2016-01-27 21:27:58 +0100 |
commit | 31a0eb8d1472ff792fe64cb75e81de16b7a5ea0b (patch) | |
tree | 4b787c4dc476247400faef8fc5830db27d22e66a | |
parent | b8b611fbb61be016ab23d1a71225f1baf2df0a91 (diff) | |
download | plyr-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.js | 2 |
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*/ |