开发者

How to know where javascript method is defined and which method is called using firebug

开发者 https://www.devze.com 2023-01-07 16:51 出处:网络
How can we know which javascript method is called and where it is defined? (When methods are attached dynamically)

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

0

精彩评论

暂无评论...
验证码 换一张
取 消