Skip to content

Commit

Permalink
Declaring variables at the top level
Browse files Browse the repository at this point in the history
  • Loading branch information
Pauan committed Apr 18, 2017
1 parent 5ed779b commit 02428b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions document.js
Expand Up @@ -2,10 +2,12 @@ var topLevel = typeof global !== 'undefined' ? global :
typeof window !== 'undefined' ? window : {}
var minDoc = require('min-document');

var doccy;

if (typeof document !== 'undefined') {
var doccy = document;
doccy = document;
} else {
var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];

if (!doccy) {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
Expand Down
10 changes: 6 additions & 4 deletions window.js
@@ -1,11 +1,13 @@
var win;

if (typeof window !== "undefined") {
var win = window;
win = window;
} else if (typeof global !== "undefined") {
var win = global;
win = global;
} else if (typeof self !== "undefined"){
var win = self;
win = self;
} else {
var win = {};
win = {};
}

module.exports = win;

0 comments on commit 02428b7

Please sign in to comment.