Reputation: 3110
The question is why debug into a function, how we know that the closure content which the function refer to?
I'm aware that Google chrome will display a closure in "Scope Variables" section, but what about other browsers? (updated: FF has similar thing but doesn't call it "closure" but just like local variables)
Motivation of the first question is actually coming along while reading the <Learning jQuery,3rd edition> - Appendix A.
At page 355, author saying following code fragment will cause memory leak at IE because of loop reference(click handler refer to a closure content which has the DOM button).
I'm just curious about whether it is the case by debug into the click handler to the closure content.However Google chrome doesn't show any closure variable.
Thus I'm wondering how author know the loop reference issue..
$(document).ready(function() {
var button = document.getElementById('button-1');
button.onclick = function() {
$.print('hello');
return false;
};
});
Thank you.
Upvotes: 0
Views: 1463
Reputation: 3825
I would refer you to use Firebug to debug your code. Its the best plugin available with dont have the exact answer to the question but you may like to have a look at these links.
Tools for debugging memory leaks in JavaScript
how to trace or debug javascript closures in firebug
Debugging closures in javascript
You can even check out the YouTube Link so as to get more information.
Hope I have tried Answering something useful.
Upvotes: 1