Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to see what javascript code is currently executing?

with firebug i only knows how to see what ajax-files are called.

i have a jquery mouse click event handler bounded to a link element.

is it possible to see what javascript code is used when clicking on an element in case you forgot if you got an event handler or other javascript code coupled to it?

like image 909
ajsie Avatar asked Feb 14 '10 20:02

ajsie


2 Answers

You can use the profiler in Firebug. Go to the Console tab, and click Profile above the message area, next to Clear. It will say that the profiler is running. Click the Profile button again, and you'll see a report on what functions were called and how much time was spent in each one.

If you're using a library like jQuery, the output may be little less clear since it will show much of the time was spent in functions from the library (i.e. F(), init(), dimension(), etc). It will show which file each function was defined in though, so you can disregard the ones that are in the library (unless that's what you're looking for).

If you're using anonymous functions, you can give them names so they show up in the profiler - see this article for a thorough (possibly too thorough) explanation.

like image 125
JAL Avatar answered Oct 17 '22 21:10

JAL


Use breakpoints ..

reference: http://getfirebug.com/javascript

like image 42
Gabriele Petrioli Avatar answered Oct 17 '22 21:10

Gabriele Petrioli