mirror of
https://github.com/mbirth/wiki.git
synced 2024-11-09 13:16:45 +00:00
36 lines
1.3 KiB
Markdown
36 lines
1.3 KiB
Markdown
---
|
|
created: 2008-12-22 14:58:35 +0100
|
|
language: en
|
|
layout: redirect
|
|
layout_old: default
|
|
redirect_to: https://blog.mbirth.de/archives/2008/12/22/firebug.html
|
|
tags:
|
|
- know-how
|
|
- development
|
|
- firebug
|
|
title: Firebug
|
|
toc: false
|
|
updated: 2009-07-24 12:34:42 +0200
|
|
---
|
|
|
|
Firebug is a useful Firefox extension to debug JavaScript and more. To not raise error messages on browsers without
|
|
Firebug, there's a small script called [firebugx.js](http://getfirebug.com/firebug/firebugx.js), which creates empty
|
|
functions. [Sascha Hameister](http://javascript.io/index.php?/archives/42-Kleiner-Performance-Patch-fuer-firebugx.js.html)
|
|
has optimized this script a little bit and it now looks like this:
|
|
|
|
{% highlight javascript %}
|
|
// FirebugX for browsers without Firebug
|
|
if (!window.console || !console.firebug) {
|
|
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "trace",
|
|
"group", "groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd", "count"];
|
|
|
|
var emptyFunction = function() {};
|
|
|
|
window.console = {};
|
|
for (var i = 0, count = names.length; i < count; ++i) {
|
|
window.console[names[i]] = emptyFunction;
|
|
}
|
|
}
|
|
{% endhighlight %}
|
|
|
|
You might also want to use [Firebug Lite](http://getfirebug.com/lite.html). |