Quick question regarding delegateEvents in a View – can we specify multiple event bindings in a single event definition?
For example, instead of:
'keyup .text-input': 'textEvents',
'keydown .text-input': 'textEvents',
'focusin .text-input': 'textEvents',
'focusout .text-input': 'textEvents',
'click .text-input': 'textEvents',
...
Is this possible?
'keyup keydown focusin focusout click .text-input': 'textEvents',
No, you can’t do that. From the fine manual:
The
eventis implicitly a single word (just like in jQuery and the DOM events) whereasselectorcan be any jQuery-style selector. Furthermore, the keys inthis.eventsare parsed using this regex:so the
eventis the first component and only the first component.You could build the
eventsobject yourself and calldelegateEventsby hand with something like this: