Fix memory leak in quick reply
This commit is contained in:
parent
71aca6040b
commit
b58ac72acd
|
@ -293,7 +293,7 @@
|
||||||
$postForm.appendTo($('body')).hide();
|
$postForm.appendTo($('body')).hide();
|
||||||
$origPostForm = $('form[name="post"]:first');
|
$origPostForm = $('form[name="post"]:first');
|
||||||
|
|
||||||
// Synchronise body text with original post form
|
// Synchronise body text with original post form. Remember to remove listeners when closing.
|
||||||
$origPostForm.find('textarea[name="body"]').on('change input propertychange', function() {
|
$origPostForm.find('textarea[name="body"]').on('change input propertychange', function() {
|
||||||
$postForm.find('textarea[name="body"]').val($(this).val());
|
$postForm.find('textarea[name="body"]').val($(this).val());
|
||||||
});
|
});
|
||||||
|
@ -346,6 +346,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$postForm.find('th .close-btn').click(function() {
|
$postForm.find('th .close-btn').click(function() {
|
||||||
|
// Remove origPostForm listeners
|
||||||
|
$origPostForm.find('textarea[name="body"]').off('change input propertychange focus');
|
||||||
|
$origPostForm.find('input[type="text"],select').off('change input propertychange');
|
||||||
|
|
||||||
$origPostForm.find('textarea[name="body"]').attr('id', 'body');
|
$origPostForm.find('textarea[name="body"]').attr('id', 'body');
|
||||||
$postForm.remove();
|
$postForm.remove();
|
||||||
floating_link();
|
floating_link();
|
||||||
|
|
Loading…
Reference in New Issue