[jQuery] Re: Chaining methods and Debugging?

2007-12-29 Thread Danny
I'm not a Firebug expert, but this seems to work: $.fn.log = function (brk){ console.log(this); if (brk) debugger; return this; }; So now $(...).log() puts the jquery object on the console and .log(true) also drops into the debugger (equivalent to setting a breakpoint). I'm not

[jQuery] Re: Chaining methods and Debugging?

2007-12-28 Thread Jeffrey Kretz
:[EMAIL PROTECTED] On Behalf Of Benjamin Sterling Sent: Thursday, December 27, 2007 7:09 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Chaining methods and Debugging? Mike, Is there a particular problem that you are trying to debug? In the beginning, I would put console.log

[jQuery] Re: Chaining methods and Debugging?

2007-12-28 Thread Mike
Splitting up the lines helps visually, and Firebug will step to each line. However, even without splitting them up, you can step-in, step- out, step-in, step-out on any chained line, and Firebug will happily step into and out of each method. That said, jQuery makes it quite possible to

[jQuery] Re: Chaining methods and Debugging?

2007-12-28 Thread Mike Schinkel
Is there a particular problem that you are trying to debug? No, it just seems the pattern I find for practically every debug session I encounter, both for Javascript/jQuery and for Drupal/PHP development. In the beginning, I would put console.log in the callbacks (if the method had one)

[jQuery] Re: Chaining methods and Debugging?

2007-12-28 Thread Danny
For quickie debugging to FIrebug, you could define $.fn.log = function { console.log(this); return this;}; and now you've got a chainable log that you can put anywhere in the chain: $('p').log().css('color', 'red').log().slideDown() etc. I haven't tested this (I'm sitting in front of IE 7) but

[jQuery] Re: Chaining methods and Debugging?

2007-12-28 Thread Mike Schinkel
Jeffrey Kretz wrote: Another option would be to use the step into and step out debug commands. Step into (F11) the css command, and if you don't want to follow it all the way down, step out of it, then step in (F11 again) to the slideDown command. I hadn't considered that because I have

[jQuery] Re: Chaining methods and Debugging?

2007-12-28 Thread Mike Schinkel
Danny wrote: For quickie debugging to FIrebug, you could define $.fn.log = function { console.log(this); return this;}; and now you've got a chainable log that you can put anywhere in the chain: $('p').log().css('color', 'red').log().slideDown() etc. I haven't tested this (I'm sitting

[jQuery] Re: Chaining methods and Debugging?

2007-12-28 Thread Mike Schinkel
Mike wrote: That said, jQuery makes it quite possible to reduce an entire application to a single line of code. Please resist this temptation, or if you cannot, split up the statements as Benjamin has shown :) Yeah, I've often thought writing an app as a single line of code was a rather

[jQuery] Re: Chaining methods and Debugging?

2007-12-27 Thread Benjamin Sterling
Mike, Is there a particular problem that you are trying to debug? In the beginning, I would put console.log in the callbacks (if the method had one) and that allowed me to see when one thing was be executed. Another tip that should probably help, instead of doing.