views:

33

answers:

3

I still consider myself a novice with javascript...so be gentle :)

Is there a way to view all open events listeners on a page and perhaps to see any inifinte loops that may be running?

What is happening, is a page I'm trying to debug works fine. Nodes get added to the page dynamically via a drag and drop method. All works well, but as time goes on, it seems to get increasingly slower - meaning the mouse starts skipping and the such.

I don't know if this is because javascript stores stuff in memory and my memory is getting used up, or if because of the constant checking of elements on mousemove slows things down as more elements are added to the page.

So I thought I would ask what I thought to be the obvious of maybe eventListeners are piling up and I'm not realizing it, or maybe there is an inifinte loop that is not being closed out.

I have firebug, and feel like I've looked at everything. I've put in console.debug statements in the loops and they all seem to end fine.

Any debugging tips would be appreciated.

A: 

not that i know of.

Here Be Wolves
+2  A: 

I would say definitely be careful of memory leaks, especially in IE. Here's a good resource for learning Javascript: www.javascriptkit.com

Specifically here are some useful articles: http://www.javascriptkit.com/jsref/events.shtml http://www.javascriptkit.com/javatutors/closuresleak/index.shtml

Aidan Brumsickle
Thanks, Aidan, I'll take a look at the articles.
Senica Gonzalez
A: 

What you need is a JavaScript profiler. Google chrome has a built in under ctrl-shift-j > profiles. There is one available in firebug for firefox as well.

Johan