Created
November 29, 2013 06:26
-
-
Save bradoyler/7702215 to your computer and use it in GitHub Desktop.
LogGlobals From http://bgrins.github.io/devtools-snippets/#dataurl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* log-globals by Sindre Sorhus https://github.com/sindresorhus/log-globals MIT License */ | |
(function () { 'use strict'; | |
function getIframe() { | |
var el = document.createElement('iframe'); | |
el.style.display = 'none'; | |
document.body.appendChild(el); | |
var win = el.contentWindow; | |
document.body.removeChild(el); | |
return win; | |
} | |
function detectGlobals() { | |
var iframe = getIframe(); | |
var ret = Object.create(null); | |
for (var prop in window) { | |
if (!(prop in iframe)) { | |
ret[prop] = window[prop]; | |
} | |
} return ret; | |
} | |
console.log(detectGlobals()); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment