From 2131e9f75abae681c253286902de4e16506be53e Mon Sep 17 00:00:00 2001 From: Kaleb Murphy Date: Thu, 27 Aug 2009 18:30:30 +0000 Subject: [PATCH] Corrected IE6/7 bugs while managing not to reintroduce the mem leak bug. --- www/extras/wobject/Survey/editsurvey.js | 59 +++++++++++++------------ 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/www/extras/wobject/Survey/editsurvey.js b/www/extras/wobject/Survey/editsurvey.js index 78be46651..9c21bf98c 100644 --- a/www/extras/wobject/Survey/editsurvey.js +++ b/www/extras/wobject/Survey/editsurvey.js @@ -77,9 +77,6 @@ Survey.Data = (function(){ lastId = d.address; } - // First purge any event handlers bound to sections node.. - YAHOO.util.Event.purgeElement('sections-panel', true); - if (!Survey.Data.ddContainer) { // Calculate the bottom of the warnings div (with a little padding) @@ -108,8 +105,14 @@ Survey.Data = (function(){ Survey.Data.ddContainer.render(); } else { + var children = document.getElementById('sections-panel').childNodes; + for( i in children){ + if(children[i].className == 'bd'){ + YAHOO.util.Event.purgeElement(children[i], true); + } + } Survey.Data.ddContainer.setBody(d.ddhtml); - Survey.Data.ddContainer.setFooter(document.getElementById("buttons")); + //Survey.Data.ddContainer.setFooter(document.getElementById("buttons")); } // (re)Add resize handler @@ -141,36 +144,36 @@ Survey.Data = (function(){ YAHOO.util.Dom.addClass(selectedId, 'selected'); } - if (sButton) { - sButton.destroy(); + if (!sButton) { + sButton = new YAHOO.widget.Button({ + label: "Add Section", + id: "addSection", + container: "addSection" + }); + sButton.on("click", this.addSection); } - sButton = new YAHOO.widget.Button({ - label: "Add Section", - id: "addSection", - container: "addSection" - }); - sButton.on("click", this.addSection); - if (qButton) { - qButton.destroy(); + if (!qButton) { + qButton = new YAHOO.widget.Button({ + label: "Add Question", + id: "addQuestion", + container: "addQuestion" + }); + qButton.on("click", this.addQuestion, d.buttons.question); } - qButton = new YAHOO.widget.Button({ - label: "Add Question", - id: "addQuestion", - container: "addQuestion" - }); - qButton.on("click", this.addQuestion, d.buttons.question); if (d.buttons.answer) { - if (aButton) { - aButton.destroy(); - } - aButton = new YAHOO.widget.Button({ - label: "Add Answer", - id: "addAnswer", - container: "addAnswer" - }); + YAHOO.util.Dom.setStyle('addAnswer', 'display', 'inline'); + if (!aButton) { + aButton = new YAHOO.widget.Button({ + label: "Add Answer", + id: "addAnswer", + container: "addAnswer" + }); aButton.on("click", this.addAnswer, d.buttons.answer); + } + }else{ + YAHOO.util.Dom.setStyle('addAnswer', 'display', 'none'); } if (showEdit == 1) {