I've always wondered... so you have a code like this:

$('#click-me');

and you attach it with this:

$('#click-me').click(someFunction);

where is the 'meta-data' that says:

"Hey "jQuery-object #click-me," I will point you to 'someFunction' when you are clicked!"

I know that event-handlers can get destroyed such as my situation with Backbone.js where my events stopped firing due to me re-rendering the entire page, destroying some background functions/objects/Views along the way.. (this is the context as to why I'm asking this question)

NOW, MY QUESTION IS:

where are events 'meta-data' stored and how are they destroyed? Are they stored within the function that bound it to a function? Are they within the DOM 'meta-data' (if there is one) itself?

I'm trying to learn the intricacies of JavaScript because I'm tired of bugs. In addition to that, I'm wondering if I should watch out for garbage collection that might detach my events and such. Coming from C#, I would say JavaScript with the DOM is really something...

(also, as a side note, how can I access these events and 'debug' them? firefox? chrome?)


UPDATE

To say it in different words, where is the information that connects a DOM element to a certain event stored? DOM? Objects? (or.. does jQuery map it? does JavaScript have a 'meta-data'? it's around that context..

Edit
Report