I'm getting a memory leak in this function, which iterates over a series of 
items in the object allSections, showing a question set in the object and a 
yes/no answer, which then get inserted in an array of results.  In Drip (memory 
leak finder for IE), I'm seeing the anchors (with the class 'answer') as 
leaking.  I've tried unbinding them at the beginning of the function, before 
they are destroyed (with just a $('.answer').unbind('click')), but they still 
show up as lost dom objects and they show as having an empty function object as 
their onclick property.  I can't think what I'm missing... 
 
function showQuestion(qIndex) { 
        $('.answer').unbind('click'); 
        if (typeof allSections[qIndex] != 'undefined') { 
                var category = allSections[qIndex]; 
                if (category.title == 'Basics') { 
                        indicesChosen.push(qIndex); 
                        qIndex++; 
                        showQuestion(qIndex); 
                } 
                else { 
                        $('#index').empty().html('Question '+(qIndex)+' of 
'+(allSections.length-1)); 
                        $('#question').empty().html(category.question+' '); 
                        $('#question').append($('Yes / No')); 
                        $('.answer').click(function() { 
                                if ($(this).html() == 'Yes') { 
                                        indicesChosen.push(qIndex); 
                                } 
                                qIndex++; 
                                showQuestion(qIndex); 
                        }); 
                } 
        } 
        else 
                completeWizard(); 
}
 
---------------------------------
Have a burning question? Go to Yahoo! Answers and get answers from real people 
who know.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to