fix for firefox memory leak

This commit is contained in:
Rolux 2010-02-05 15:04:07 +05:30
parent 93432f2fe7
commit 8e84f1f550

View File

@ -212,19 +212,16 @@ requires
return {
bind: function(id, event, callback) {
if (isKeyboardEvent(event)) {
keyboardEvents[id] = keyboardEvents[id] || [];
keyboardEvents[id].push({
event: event,
callback: callback
});
keyboardEvents[id] = keyboardEvents[id] || {};
keyboardEvents[id][event] = callback;
}
if (!isKeyboardEvent(event) || Ox.Focus.focused() == id) {
$eventHandler.bind(event, callback);
}
},
bindKeyboard: function(id) {
$.each(keyboardEvents[id] || [], function(i, event) {
Ox.Event.bind(id, event.event, event.callback);
$.each(keyboardEvents[id] || [], function(event, callback) {
Ox.Event.bind(id, event, callback);
});
},
trigger: function(event, data) {
@ -233,9 +230,9 @@ requires
},
unbind: function(id, event, callback) {
if (isKeyboardEvent(event)) {
$.each(keyboardEvents[id] || [], function(i, e) {
if (e.event == event) {
keyboardEvents[id].splice(i, 1);
$.each(keyboardEvents[id] || [], function(e, callback) {
if (e == event) {
delete keyboardEvents[id][e];
return false;
}
});
@ -245,8 +242,8 @@ requires
unbindKeyboard: function(id) {
//Ox.print(keyboardEvents)
//Ox.print("unbindKeyboard", id, keyboardEvents[id])
$.each(keyboardEvents[id] || [], function(i, e) {
$eventHandler.unbind(e.event, e.callback);
$.each(keyboardEvents[id] || [], function(event, callback) {
$eventHandler.unbind(event, callback);
});
}
}