MINOR Fixed jQuery.jstree men leaks on 'dnd' and 'context menu' plugins, by removing globally bound event handlers (see #7258)

This commit is contained in:
Ingo Schommer 2012-06-14 18:11:51 +02:00
parent 5260738148
commit 7ba759e77b

View File

@ -2542,6 +2542,15 @@
drag_finish : $.noop,
drag_check : function (data) { return { after : false, before : false, inside : true }; }
},
__destroy : function () {
// unbind global event handlers when last instance is removed
// (no access to private 'instances' variable from here)
if($('.jstree').length <= 1) {
$(document)
.unbind("drag_start.vakata")
.unbind("drag_stop.vakata");
}
},
_fn : {
dnd_prepare : function () {
if(!r || !r.length) { return; }
@ -3719,6 +3728,13 @@
}, this));
$(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));
},
__destroy: function() {
// unbind global event handlers when last instance is removed
// (no access to private 'instances' variable from here)
if($('.jstree').length <= 1) {
$(document).unbind("context_hide.vakata");
}
},
defaults : {
select_node : false, // requires UI plugin
show_at_node : true,