From: Coleman Watts Date: Tue, 11 Mar 2014 18:35:49 +0000 (-0400) Subject: CRM-14336 - Clear up potential memory leaks from ajaxForm X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e8a13789038150776aa83e24d8046c4dc23fb160;p=civicrm-core.git CRM-14336 - Clear up potential memory leaks from ajaxForm --- diff --git a/templates/CRM/Contact/Page/View/Summary.js b/templates/CRM/Contact/Page/View/Summary.js index 82a46c4ce6..e8c76d22d9 100644 --- a/templates/CRM/Contact/Page/View/Summary.js +++ b/templates/CRM/Contact/Page/View/Summary.js @@ -43,6 +43,7 @@ function requestHandler(response) { var o = $('div.crm-inline-edit.form'); + $('form', o).ajaxFormUnbind(); if (response.status == 'save' || response.status == 'cancel') { o.trigger('crmFormSuccess', [response]); @@ -99,7 +100,6 @@ } else { // Handle formRule error - $('form', o).ajaxForm('destroy'); $('.crm-container-snippet', o).replaceWith(response.content); $('form', o).validate(CRM.validate.params); $('form', o).ajaxForm(ajaxFormParams); @@ -211,6 +211,7 @@ // Inline edit form cancel button .on('click', '.crm-inline-edit :submit[name$=cancel]', function() { var container = $(this).closest('.crm-inline-edit.form'); + $('form', container).ajaxFormUnbind(); $('.inline-edit-hidden-content', container).nextAll().remove(); $('.inline-edit-hidden-content > *:first-child', container).unwrap(); container.removeClass('form');