In the Chrome dev tools, I often use the following workflow:
- Open console
- Access a function from its global symbol (e.g.
$.fn.offset
ormyObj.getFoo
) - Console displays the first ~50 chars of the function body
- Click that
- I am now in the “Sources” (debugger) view, at that function
This is very useful when I’m trying to find a particular function that I know the global symbol of but that I don’t know how to find (is it .prototype.offset =
, or offset:
? or maybe it’s dynamic? what if there are multiple functions called offset
?), or if I’m debugging and have an object and wonder “what code executes if I call myObj.blahFunc()
?”.
Unfortunately, this doesn’t work in Firefox. I can type the name of a function in the console, and it’ll display as a Function object, but I haven’t found a way to get from there to the code of the function in the debugger view.