Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Debugging CSS, AJAX and DOM with Firebug

CowboyNeal posted more than 7 years ago | from the when-the-bugs-bite dept.

Mozilla 55

prostoalex writes "Joe Hewitt of Parakey in the latest Dr. Dobb's Journal provides a detailed overview of the Firebug extension for Firefox: 'Firebug breaks the page down into a set of tabs that depict its most important aspects — HTML, CSS, JavaScript, the DOM, network activity, and a console for errors and log messages. No tab is an island; Firebug lets you browse code just as you browse the Web by presenting objects as hyperlinks that can take you from one view to another.'"

cancel ×

55 comments

Sorry! There are no comments related to the filter you selected.

Perfect Tool (4, Funny)

RotHorseKid (239899) | more than 7 years ago | (#17570452)

You're definitely at a disadvantage as an AJAX developer when you are not using it.

Well, now its on /., there goes my advantage.

Aptana IDE... (0)

Anonymous Coward | more than 7 years ago | (#17576904)

A great, open-source IDE with full FireFox debugging support: http://aptana.com/ [aptana.com] and http://aptana.tv/ [aptana.tv]

last semester (-1, Redundant)

Lehk228 (705449) | more than 7 years ago | (#17570500)

i REALLY could have used this last semester during advanced web design class.

Re:last semester (1)

pasamio (737659) | more than 7 years ago | (#17570946)

I picked up on Firebug first time Slashdot mentioned it when linking to a Google blog over a year and a bit ago that was talking about AJAX. Plus, you never know whats out there until you spend a bit of time reading through things (and every few months I trawl through extensions.mozilla.org to find interesting extensions) - especially when you're looking at a difficult way to do the task initially.

Re:last semester (0)

Anonymous Coward | more than 7 years ago | (#17577084)

i REALLY could have used this last semester during advanced web design class.

What did you do, coded some cool <marquee> s using FrontPage?

Re:last semester (1)

Lehk228 (705449) | more than 7 years ago | (#17579988)

yup, that's exactly what i did

Good but no cigar (3, Informative)

WarwickRyan (780794) | more than 7 years ago | (#17570538)

Firebug is an excellent and extremely useful extention, however alone it does not provide everything you need.

Combine Firebug with the Web Developer Toolbar ahref=https://addons.mozilla.org/firefox/60/rel=ur l2html-27791 [slashdot.org] https://addons.mozilla.org/firefox/60/ > and the included DOM Inspector and you've got yourself an excellent debugging environment.

Re:Good but no cigar (5, Informative)

jhewitt (120161) | more than 7 years ago | (#17570656)

The DOM Inspector is not part of the Web Developer extension - it is included with Firefox itself. Web Developer simply includes a shortcut to DOM Inspector.

DOM Inspector was actually written by the same person who wrote Firebug: myself, 6 years ago. There is no reason to use DOM Inspector any longer. Firebug does everything it does and more, but with a much more pleasant and modern user interface.

Re:Good but no cigar (1)

WarwickRyan (780794) | more than 7 years ago | (#17570752)

> The DOM Inspector is not part of the Web Developer extension - it is included with Firefox itself

That's what I said. The included DOM Inspector extension. As in included (with) the browser. I should have been a little bit clearer on the context though..

DOM Inspector's excellent for javascript debugging, as you can use the full screen easily and can switch windows fast (extremely useful for debugging the tangle of JS in some webapps).

> DOM Inspector was actually written by the same person who wrote Firebug: myself, 6 years ago.

I guess a thanks is in order! Both applications are excellent and extremely useful.

There's not much missing from them, either - the only function I can think of is an ability to search the DOM - both the objects and the data in them (for finding js variables).

Re:Good but no cigar (5, Informative)

jhewitt (120161) | more than 7 years ago | (#17570802)

> DOM Inspector's excellent for javascript debugging, as you can use the full screen easily and can switch windows fast (extremely useful for debugging the tangle of JS in some webapps).

Perhaps you haven't tried Firebug 1.0, which allows you to open Firebug as a separate window. Versions prior to 1.0 did restrict you to a panel at the bottom of the browser.

Re:Good but no cigar (1)

WarwickRyan (780794) | more than 7 years ago | (#17570836)

Funny you should say that. Just downloaded it after seeing mention a few comments down.

You've really nailed it - this version is absolutely fantastic. Brilliant.

Re:Good but no cigar (0)

Anonymous Coward | more than 7 years ago | (#17571164)

There is no reason to use DOM Inspector any longer.
There is, alas. It works with my chosen browser, SeaMonkey, whereas Firebug doesn't (as far as I'm aware, and I'd gladly try out Firebug if it did).

Re:Good but no cigar (3, Insightful)

Paradise Pete (33184) | more than 7 years ago | (#17572912)

There is, alas. It works with my chosen browser, SeaMonkey, whereas Firebug doesn't

What difference does it make what your browser of choice is? You're developing, not browsing.

Re:Good but no cigar (2, Insightful)

Aladrin (926209) | more than 7 years ago | (#17572160)

Please allow me to kiss your feet. ;)

But seriously, Firebug (and the webdev extension) have made my job a LOT easier. (And my co-workers, too.) Problems that took me 30 minutes to an hour in the past to find, I can now find them in seconds. It's been a god-send. Thank you so much.

Re:Good but no cigar (0)

Anonymous Coward | more than 7 years ago | (#17584024)

and you make how much an hour?
Shut up and pay the man. We all owe him money even if he released the extension for free.
At least donate 5 dollars or something.
You and 4 co-workers can find 4 quarters a piece can't you?

thanks for the app!
not only does it make all the advanced stuff easy but for a total beginner like me it actually makes javascript easier to learn because I have the console to play around in. This year makes the 4th time in 6 years that I've tried to learn javascript. The first time that I'm actually learning enough to be productive. And thanks to firebug (and prototype) I'm very very very productive.

Re:Good but no cigar (1)

Vraylle (610820) | more than 7 years ago | (#17572268)

I'm sure this thread is/will be filled with gushing posts of thanks. I'd hate to be left out, so...thanks! Firebug has been a wonder and a lifesaver on countless occasions.

Re:Good but no cigar (1)

Ramses0 (63476) | more than 7 years ago | (#17573464)

...except for the ability to access / look at the Javascript object for a dom node in a nice convenient way (ie: document.getElementById('foo') in Firebug Console, v. dir( $('foo') ), v. domInpsect: 'foo'). I'm pretty sure there's a way to get at the JS view of the dom node with firebug, but it's not very straightforward by default.

But you (I) certainly use the Dom inspector less after Firebug, and all hail Joe and his cohorts!! :^)

--Robert

Re:Good but no cigar (0)

Anonymous Coward | more than 7 years ago | (#17573996)

does fire bug have a profiler?

Re:Good but no cigar (1)

Ayende Rahien (309542) | more than 7 years ago | (#17581232)

In that case, allow me to exclaim:
Thanks!

Re:Good but no cigar (1)

Seraphim_72 (622457) | more than 7 years ago | (#17582384)

I have to admit, I hated developing in javascript. But when I got firebug a while back I could have cried for joy. You have made a fantastic thing. I bow down to you Sir. As it stands, I have caught the Ajax bug because of firebug, Thank You.

Sera

Re:Good but no cigar (0)

Anonymous Coward | more than 7 years ago | (#17572250)

But would any of that have helped you place your HTML tags right?

Link to old extension (5, Informative)

jhewitt (120161) | more than 7 years ago | (#17570608)

The article links to the wrong page for Firebug, it is currently pointing to the old version of the extension (0.4.1). Firebug 1.0 beta is a dramatic step ahead of 0.4, and you can get it at http://www.getfirebug.com/ [getfirebug.com]

It would be a shame if everyone installs 0.4 and misses out on all the great new stuff in 1.0.

Re:Link to old extension (0)

Anonymous Coward | more than 7 years ago | (#17570790)

Any chance of a part to SeaMonkey?

Re:Link to old extension (0)

Anonymous Coward | more than 7 years ago | (#17572354)

Any chance of a part to SeaMonkey?

I dunno, maybe he could play the dwarf. What credits does he have?

Re:Link to old extension (0)

Anonymous Coward | more than 7 years ago | (#17573572)

s/part/port/ obviously

Re:Link to old extension (1)

ErroneousBee (611028) | more than 7 years ago | (#17570898)

Hey everybody! I've just installed a browser extension from a site I've never seen before, based on a recommendation on a website! Would you like my credit card numbers?

Seriously. I've just installed it, seems OK. I hope the annoying reporting of bugs that don't exist when using window.open() is gone.

Re:Link to old extension (1)

suv4x4 (956391) | more than 7 years ago | (#17571048)

As a long time Firebug user I want to thank you the excellent product you gave to the community!

The new version is amazing as well, I just started to play with it.

It won't be an overstatement to say that this sole extension is saving web developers worldwide thousands of debugging hours: every single day.

Firebug 1.0 is FANTASTIC. (1)

Civil_Disobedient (261825) | more than 7 years ago | (#17572758)

Joe, I just wanted to take this opportunity to thank you for your work with FireBug. It has saved me hundreds of hours of debugging time! I work with a Java-based development team who were giving me a ton of shit for our last project, a webapp that used quite a bit of Ajax. They derided JavaScript for a number of reasons (many well-founded), but their biggest problem was that it was nearly impossible to debug without tons of alert boxes. With the first release of FireBug I was finally able to shut them up! "Look, object inspection! Breakpoints! Huzzah!"

When we finished the app and started unit testing, they again gave me grief over the fact that you couldn't properly test for coding inefficiencies. With FireBug 1.0's built-in profiler, I again have an answer to them.

FireBug is THE killer-extension for web developers. Your work is extremely appreciated.

Re:Link to old extension (1)

professorfalcon (713985) | more than 7 years ago | (#17585756)

It's hard to find the version number of the plug-in.

debug (3, Funny)

mastershake_phd (1050150) | more than 7 years ago | (#17570718)

I debug with chemicals, and sometimes a hammer.

Re:debug (1)

rodia (1031082) | more than 7 years ago | (#17570824)

> and sometimes a hammer.
for the big ones, eh?

Exellent tool but, but not for web developers (0, Interesting)

Anonymous Coward | more than 7 years ago | (#17570770)

If you enjoy using FireBug, it is likely you are not really productive...

Don't get me wrong, I think the tool is excellent, but do you really want to go bug chasing at this low level of abstraction ? You can easily waste hours debugging like this, figuring out what exactly happened (or didn't happen) ...

I think you are better off using a high level AJAX toolkit like echo2 [nextapp.com] or Wt [sf.net] instead, blame their developers for any JavaScript or other unexpected trouble, and let developers of these toolkits enjoy FireBug in ironing out these bugs.

Re:Exellent tool but, but not for web developers (3, Insightful)

Azarael (896715) | more than 7 years ago | (#17572290)

Not everyone has the option of integrating a whole ajax toolkit into their work. Anyway, ajax is far from the only thing that firebug is useful for. The error reporting makes it a lot easier to track down and repair general javascript problems than with the existing console.

Re:Exellent tool but, but not for web developers (1)

erlando (88533) | more than 7 years ago | (#17572356)

Surely you are kidding or trolling - maybe both?

FireBug with its plethora of functions is indispensable for any web developer. In my mind it's clear that you never even looked at it.

FireBug is not for ajax only. And as another poster noted not everyone has the freedom or willingness to use 3rd party ajax-frameworks.

Re:Exellent tool but, but not for web developers (5, Informative)

kae_verens (523642) | more than 7 years ago | (#17572818)

Are you totally mad? How can something as useful as this do anything but increase productivity? Today, for example, I needed to find out why a certain element in a layout was screwing up the design. All I needed to do was turn on Firebug's inspector, click the element, and read through the list of specific CSS lines that affected that element, and there it was! Total time wasted - 3 minutes. If Firebug had not been installed, I would have had to read through three CSS sheets, inspecting each line and figuring out if it could affect the element. Total time wasted could have been measured in hours, then!

Re:Exellent tool but, but not for web developers (-1)

Anonymous Coward | more than 7 years ago | (#17573768)

> Are you totally mad? How can something as useful as this do anything but
> increase productivity? Today, for example, I needed to find out why a certain
> element in a layout was screwing up the design. All I needed to do was turn on
> Firebug's inspector, click the element, and read through the list of specific
> CSS lines that affected that element, and there it was! Total time wasted
> - 3 minutes.

It's just I would think that increased productivity and time wasted are contradictions and to increase productivity you should stop wasting time.

10 css errors on this page (3, Interesting)

HxBro (98275) | more than 7 years ago | (#17570920)

I've been using firebug for a while, it's great, shows up errors on pages quickly and easily. This page alone has 10 CSS errors apparently :)

Between firebug and the html validator extension (requires html validator) http://www.htmlvalidator.com/firefoxext.php [htmlvalidator.com] you can quickly pick up and find the errors on the page.

Re:10 css errors on this page (4, Informative)

jasonwea (598696) | more than 7 years ago | (#17571140)

This addon does not appear to be Free (as in speech) and also only runs on Windows.

I much prefer HTML Validator [skynet.be] . I find both the Tidy and W3C validators incredibly useful. The Tidy function to clean up existing markup is also rather handy.

Venkman (0)

Anonymous Coward | more than 7 years ago | (#17571270)

How does it compare to Venkman?

Re:Venkman (5, Informative)

jimmy_dean (463322) | more than 7 years ago | (#17571704)

Venkman doesn't hold a candle to Firebug. Firebug is fast, easy, nice looking, and blows the features of Venkman out of the water. Give it a try, you'll find yourself say Venkman...what's that?

Not only for development (5, Interesting)

aymanh (892834) | more than 7 years ago | (#17571880)

Not only does Firebug provide excellent tools for debugging web applications, but it also has facilities for modifying web pages on the fly. Sometimes there is an annoying div on a webpage that I want to get rid of while reading, so I open the Firebug console and set its display property to none. There may be other extensions that provide similar features (Adblock Plus [mozilla.org] , Nuke This [mozilla.org] ); however, the JavaScript console in Firebug is the ultimate tool for running your own code on 3rd party web pages, for those who know Javascrpt, that is.

Furthermore, the JavaScript console can be very helpful for those starting to learn JavaScript, like how the Python console is for Python beginners.

Re:Not only for development (3, Informative)

maxume (22995) | more than 7 years ago | (#17573530)

If you don't feel like installing the extension, you can get by with a bookmark:

http://www.squarefree.com/bookmarklets/webdevel.ht ml#shell [squarefree.com]

These also come in handy:

http://www.squarefree.com/bookmarklets/zap.html [squarefree.com]

Zap Style Sheets can make myspace quite a lot easier to read.

Re:Not only for development (1)

Nappa48 (1041188) | more than 7 years ago | (#17574090)

Those links are pretty awesome!

I'm actually making an HTML/JS/CSS etc Sandbox that i can hook onto a website so i can play around with things.
Still needs alot of testing though, and sadly i don't have alot of free-time just now.
Just when i managed to get the iframing to work!

Re:Not only for development (1)

josepha48 (13953) | more than 7 years ago | (#17578478)

My only wish is that IE had the same tool. I use this a lot for debugging / developing and testing my pages, but then when I try some things in IE, IE just gives script error or shoots me into its debugger without a way of really seeing what is going on in the page.

I also like it when I come to pages and see the little red error, so I can tell who spends time on their script.

This is an awesome tool and I always recommend it to ANYONE who is doing any JavaScript development.

Re:Not only for development (1)

after fallout (732762) | more than 7 years ago | (#17589904)

http://www.microsoft.com/downloads/details.aspx?fa milyid=e59c3964-672d-4511-bb3e-2d5e1db91038&displa ylang=en [microsoft.com]

About as close as you are going to get at the moment. I wish for it too.
Something to think about: build you page in Firefox and get it perfect there, only then should you try to go out of your way to make it work ok in IE (much easier than the other way around).

Can Firebug help debug performance problems? (-1, Redundant)

Anonymous Coward | more than 7 years ago | (#17572036)

Is it possible to use Firebug as a profiler of AJAX applications? Can we use it to help us debug some of the serious performance problems me and my coworkers noticed with AJAX applications?

AJAX applications just aren't solid or stable, for the most part. We tried to integrate a number of them into our network here, and frankly each attempt went terribly. I'd like to think it was just one application vendor or AJAX toolkit that was problematic, but that wasn't the case.

We found a number of common problems with every AJAX application we tried. Just for the record, the applications included three CMS systems, a Web-based email system, two groupware systems, and three Web forums.

The first major problem with one of resource usage, on both the client-side and the server-side. Client-side, many AJAX applications consume far too much CPU time. From our investigation, it was due to the use of poor JavaScript algorithms that'd consume 100% of the CPU in some cases, for minutes on end. The applications "worked", in that they'd provide the correct result. It'd just take them far too long to get it done.

On the server-side, they'd again result in excessive CPU and RAM consumption. For one of the Webmail systems, we could only handle a fifth (yes, 20%) of what our old Perl-based system could. And that was on a quad-core Opteron system with 8 GB of RAM! The Perl-based system was on a couple of 200 MHz Pentium systems, each with 128 MB of RAM. Even after assistance from the AJAX-based Webmail system's vendor, we were only able to handle roughly 90% of the number of transactions of our older system.

The second major problem is that of usability. Many of the AJAX apps we tried didn't play well with browser tabs, for instance. Some even fucked around with text input areas, resulting in copy-and-pasting no longer working. One application even prevented the text within a text field from being highlighted! We thought these problems may be browser-specific incompatibilities, be we ran into this same problem with Firefox, Safari, Opera, and even IE6! After talking with the vendor, they admitted these were known problems, and no solutions were presently available.

The third major problem is a lack of quality. Many AJAX applications are poorly coded and poorly designed. I think the main reason for that is because it's such an unstructured technology. Even competent software developers run into problems that cannot be solved easily, and thus must resort to hackish techniques to overcome these inherent problems.

The fourth major problem was that the users hated the systems. Of the few systems we managed to roll out successfully, the users absolutely hated them. Their complaints were a combination of the above three factors. The AJAX applications would not do what the user wanted. The AJAX applications did not conform to common practices (eg. copy-and-paste, textbox text selection, etc.). The AJAX applications ran far too slowly, even on fast client machines. The AJAX applications just plain didn't work!

All of our AJAX trials were abysmal failures. That's why we're sticking with the existing Perl- and Java-based systems that we currently use. They perform far better on much fewer resources, actually do what the users want, avoid violating the most common of conventions, and they do what they're supposed to. I'm sorry to say it, but AJAX might just be the worst technology I have ever had to deal with.

http://it.slashdot.org/comments.pl?sid=215452&cid= 17491660 [slashdot.org]

Re:Can Firebug help debug performance problems? (0)

Anonymous Coward | more than 7 years ago | (#17572230)

Cut and paste troll. Do you really have that little to do with your time that you feel the need to copy the same comment into every Slashdot article that includes the word "Ajax"?

Re:Can Firebug help debug performance problems? (0)

Anonymous Coward | more than 7 years ago | (#17572420)

I don't think the GP's post is a troll. I've tried to use Ajax for some hobby web apps I built recently, and I experienced them running too slowly, too. I'd really like to get them deployed, but I really don't know which parts of the app are running slowly, or if there are any bottlenecks, and so forth. It'd really help me out a lot of there was a tool for easily profiling Ajax web apps.

Re:Can Firebug help debug performance problems? (1)

sammyo (166904) | more than 7 years ago | (#17573374)

If not a troll then some other variety of lazy cut&paste, I have seen the identical post at least once before.

The theme that Ajax/Web 2.0 (cue violins) have too high glitz to function ratio is not unwarrented, repetitive cut&paste postings does obscure that point.

Re:Can Firebug help debug performance problems? (1)

NickFitz (5849) | more than 7 years ago | (#17575796)

It'd really help me out a lot of there was a tool for easily profiling Ajax web apps.

There is. It's called Firebug.

Re:Can Firebug help debug performance problems? (1)

kae_verens (523642) | more than 7 years ago | (#17572866)

> Is it possible to use Firebug as a profiler of AJAX applications? Can we use it to help us debug some of the serious performance problems me and my coworkers noticed with AJAX applications?

yes.

there is a button called "Profile". you click that, run your script, then click "Profile" again, and a list of functions and how much time they took will show up.

Very Useful (3, Insightful)

antialias02 (997199) | more than 7 years ago | (#17572164)

Rarely a day goes by when I don't find some use for Firebug, but I concur with the sentiment that the Web Developer's Toolbar is often needed to create a powerhouse set of dev tools for the Web. If all you have are these two, you're a head and shoulders ahead of the game.

firebug rocks (1)

motherball (514667) | more than 7 years ago | (#17573268)

Firebug is awesome. that's how I learned the DOM.

Firebug ROCKS!!!! (1)

xmas2003 (739875) | more than 7 years ago | (#17574574)

Have been using for a while ... and yea, be sure to 1.x Beta [getfirebug.com] which is major improvement on what was already a great product.

Good timing (1)

Anthony (4077) | more than 7 years ago | (#17580838)

Just installed Firebug a couple of days ago to look at a wierd "works in IE, not in firefox" problem. Haven't nailed it yet as is could be server-side but was impressed by the comprehensive coverage of the tool.
Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>