add destroy method

This commit is contained in:
vitalets
2013-01-08 12:36:35 +04:00
parent 87f214adf4
commit 2fd6340b03
4 changed files with 44 additions and 2 deletions

@ -341,7 +341,24 @@ Makes editable any HTML element on the page. Applied as jQuery method.
if(this.container) {
this.container.activate();
}
}
},
/**
Removes editable feature from element
@method destroy()
**/
destroy: function() {
if(this.options.toggle !== 'manual') {
this.$element.removeClass('editable-click');
this.$element.off(this.options.toggle + '.editable');
}
if(this.container) {
this.container.destroy();
}
this.$element.removeClass('editable');
this.$element.removeClass('editable-open');
this.$element.removeData('editable');
}
};
/* EDITABLE PLUGIN DEFINITION