don't invoke global event handlers if keyboard event and focused element is input
This commit is contained in:
parent
2aec28f105
commit
02da127698
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue