javascript - Altering firebugx.js to Accommodate IE Developer Tools -


the firebugx.js file (shown below) checks both !window.console , !console.firebug, correctly detects if firebug installed. however, check not accommodate native console object in ie developer tools -- overwrites ie console object.

for example, if include firebugx.js code, following exception not appear in ie console (it swallowed):

  function foo() {     try {       throw "exception!!!";     }     catch (e) {       console.error(e);     }   } 

question: best approach accommodating ie developer debugger? maybe obvious answer comment out firebugx.js check when debugging in ie. there other approaches?

reference:

firebugx.js

if (!window.console || !console.firebug) {     var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",     "group", "groupend", "time", "timeend", "count", "trace", "profile", "profileend"];      window.console = {};     (var = 0; < names.length; ++i)         window.console[names[i]] = function() {} } 

i suppose following modification firebugx.js solve problem. redefine window.console if not exist , optionally define missing functions on window.console. hesitant alter firebugx.js, can't see downside this. it's easiest way switch between firefox , ie debuggers.

firebugxcustom.js

if (!window.console) {   window.console = {}; } if (!window.console.firebug) {   var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",     "group", "groupend", "time", "timeend", "count", "trace", "profile", "profileend"];    (var = 0; < names.length; ++i) {     if (!window.console[names[i]]) {       window.console[names[i]] = function () { }     }   }  } 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -