Permalink
Browse files

BUGFIX: TinyMCE isnt unbinding formatselect or styleselect which leak…

…s memory. We should really fix TinyMCE, but lets just brute-force it for now.
  • Loading branch information...
1 parent e58929d commit 1085fd29be25147c393ba8b721f2c6034bc5c48b Hamish Friedlander committed with chillu Jun 14, 2012
Showing with 15 additions and 1 deletion.
  1. +15 −1 javascript/HtmlEditorField.js
@@ -216,7 +216,21 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
},
onremove: function() {
var ed = tinyMCE.get(this.attr('id'));
- if (ed) ed.remove();
+ if (ed) {
+ ed.remove();
+
+ // TinyMCE leaves behind events. We should really fix TinyMCE, but lets brute force it for now
+ $.each(jQuery.cache, function(){
+ var source = this.handle && this.handle.elem;
+ if (!source) return;
+
+ var parent = source;
+ while (parent && parent.nodeType == 1) parent = parent.parentNode;
+
+ if (!parent) $(source).unbind().remove();
+ })
+ }
+
this._super();
},

0 comments on commit 1085fd2

Please sign in to comment.