sindresorhus / log-globals

Logs your global variables to the console - Bookmarklet / DevTools snippet
MIT License
118 stars 6 forks source link

DevTools extension #1

Open sindresorhus opened 10 years ago

sindresorhus commented 10 years ago

Might be useful to have this as a DevTools panel extension.

Cycymomo commented 10 years ago

:+1:

Why "display: none" ?

smaller version : javascript:console.log(function(d,i,s,c,o){i=(d=document).body.appendChild(s=d.createElement('iframe')).contentWindow,c=Object.create(null);d.body.removeChild(s);for(o in this)o in i||(c[o]=this[o]);return c}())

sindresorhus commented 10 years ago

Why "display: none" ?

To hide it.

Size doesn't matter since you add it to your Snippets collection in DevTools.

Cycymomo commented 10 years ago

Yes, I know what "display: none" does :) Sorry, let me rephrase my question : why hide it if it's removed ? Is this just a security issue ?

Btw, thanks for the snippet, it helped me remove some global leak in my apps

sindresorhus commented 10 years ago

Yes, I know what "display: none" does :) Sorry, let me rephrase my question : why hide it if it's removed ? Is this just a security issue ?

The iframe is added then removed right after. It's just to be sure it's not shown.

Btw, thanks for the snippet, it helped me remove some global leak in my apps

That's awesome :)