this.options.crmForm && $('form', this.element).ajaxFormUnbind();
},
_destroy: function() {
- this.element.removeClass('crm-ajax-container');
+ this.element.removeClass('crm-ajax-container').trigger('crmUnload');
this._beforeRemovingContent();
if (this._originalContent !== null) {
this.element.empty().append(this._originalContent);
// This is drupal's old-school way of listening for 'load' type events. It has to be called manually.
Drupal.attachBehaviors(this);
})
+ .on('crmUnload', function() {
+ Drupal.detachBehaviors(this);
+ })
.on('dialogopen', function(e) {
// D7 hack to get the toolbar out of the way (CRM-15341)
$('#toolbar').css('z-index', '100');