1

How can we know which javascript method is called and where it is defined? (When methods are attached dynamically) Let us consider situation where JQuery Bind method is used to bind an event. If I see control in FireBug with FireQuery, I can see events=Object{click =} handle=function() But I don't know which method is attached with click event. Is there any way to detect this method is being called from this file? For 3-4 files, I could search. but for large number of files with heavy code, it is difficult to search.

3 Answers 3

1

You can use console.trace() but this only works within the function

You may also find the question and answer here useful: what events are bound?

Sign up to request clarification or add additional context in comments.

3 Comments

If I know the function then I can put breakpoint. I know only control and need to know about associated methods.
In webkit you inspect a element and see the attached events and their scope/definition. Whether this is in Firebug I am unsure. Otherwise you will just have to browse and add breakpoints, or put the browser into a pause and step through mode. Alternatively instead of inspecting the element, you could do this by clicking pause on the javascript, then clicking the button you want, then you'll break at what is fired and you can step through.
1

You should be able to click on the "function()" and firebug 1.6 will navigate to the source.

1 Comment

firebug 1.6 is in alpha version
1

just mouseover the event handler function in firebug (if fireQuery is installed)

Firebug http://img842.imageshack.us/img842/3307/scrg.jpg

http://img842.imageshack.us/img842/3307/scrg.jpg

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.