14
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

グローバル汚染を見つける

Posted at

JavaScriptにおいて忌み嫌われるグローバル汚染ですが、そんなグローバル汚染を起こしている変数・プロパティを列挙するスクリプトを書きました。
ここのやつが使えなくなっていたので……

ソースコード

(function() {
  var r = '',
      w = open('', '', 'width=300,height=500');
  for (var p in window)
    if (!(p in w)) r += p + '<br>';
  w.document.write(r);
})();

ブックマークレット

[このリンク先](#javascript:!function(r,w,p){for(p in window)p in w||(r+=p+'
');w.document.write(r)}('',open('','','width=300,height=500'));)をブックマークに登録し、設定を開き、URLの「#」とその前の部分を消してください。

14
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?