JavaScript - Quick And Dirty Way To Check The State Of Global Scope After A Script Has Done Loading (+30ms)

Posted at

Using the latest jQuery 2 git

var old = {};
for(var a in window){
  old[a] = window[a];
}

var s = document.createElement("script");
s.type = "application/javascript";
s.src="http://code.jquery.com/jquery-git.js";
s.onload = function(){
  setTimeout(function(){
    for(var a in window) (false === old.hasOwnProperty(a)) && console.log(a, window[a]);
  }, 30);
};
document.body.appendChild(s);


will output
icompile.eladkarako.com_global_scope_diff_after_script_load_2016-01-22_170946