Posted By

1man on 03/18/08


Tagged

command console firebug lite


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

SpinZ
kcmr
johnloy
jlizarraga


Stop Firebug Console Command Errors


 / Published in: JavaScript
 

URL: http://getfirebug.com/lite.html

Sometimes i forget to remove firebug console commands when debuging, which makes IE and some other browsers fail / cry.

To stop this happening use the below script from firebugx.js on the firebug lite homepage.

  1. (function(){
  2. if (!window.console || !console.firebug) {
  3. var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
  4.  
  5. window.console = {};
  6. for (var i = 0; i < names.length; i++) {
  7. window.console[names[i]] = function(){};
  8. }
  9. }
  10. })();

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: jlizarraga on July 22, 2009

To avoid phantom global "names" and "i" variables, encapsulate this snippet in a self-executing function, like so:

(function(){ ...Snippet... })();

You need to login to post a comment.