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.
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?
You should be able to click on the "function()" and firebug 1.6 will navigate to the source.
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
精彩评论