don't invoke global event handlers if keyboard event and focused element is input

This commit is contained in:
rlx 2014-09-26 12:56:22 +02:00
parent 2aec28f105
commit 02da127698

View file

@ -133,11 +133,13 @@
callbacks = options.callbacks, callbacks = options.callbacks,
that = this; that = this;
Ox.forEach(Ox.makeObject(args), function(data, originalEvent) { Ox.forEach(Ox.makeObject(args), function(data, originalEvent) {
var events = originalEvent.split('.'); var events = originalEvent.split('.'),
triggerGlobally = !isKeyboardEvent(originalEvent)
|| !Ox.Focus.focusedElementIsInput();
['*'].concat(events.map(function(event, index) { ['*'].concat(events.map(function(event, index) {
return events.slice(0, index + 1).join('.'); return events.slice(0, index + 1).join('.');
})).forEach(function(event) { })).forEach(function(event) {
(callbacks[0][event] || []) (triggerGlobally ? callbacks[0][event] || [] : [])
.concat(callbacks[1][event] || []) .concat(callbacks[1][event] || [])
.forEach(function(callback) { .forEach(function(callback) {
callback.call(that, data, originalEvent, that); callback.call(that, data, originalEvent, that);