开发者

how to find out which file contains a javascript function

I've taken over a project which involves a lot of javascript (AJAX and whatnot). In tracking dow开发者_开发百科n functions, is there a way to find out which included .js file contains a specific function?

I'm hunting through Firebug but can't find where it isolates the specific file which contains the javascript function. What am I missing?


The Web Developer plugin (for FF and Chrome http://chrispederick.com/work/web-developer/) has a "View JavaScript" feature that shows all of the JS that a page is referencing on a single page. CTRL-F from there to find the function.


Fiddler will let you search through all requests, so you could load the page in Fiddler, then search for your function.

http://www.fiddler2.com/fiddler2/


Certain text editors, including Notepad++, allow you to search all files in a directory. You can use that to search for "function foo(" and that should pull it up.

Of course, that assumes the function is declared like that. It could also be assigned, which would be a bit more difficult. You'd have to search for something like "foo\s*=" (using Regex search).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜