Question: How to bind event handlers for custom events?
JesperWe opened this issue · 7 comments
The documentation for the new event handler bindings is a bit brief, and only use 'click' events in the examples, which are handled by binding with onClick. It would be helpful to document how to bind other events too. Can I always just capitalize the first letter and prepend "on", or what is the algorithm? For example, how would I bind the shown.bs.collapse
event in Bootstrap?
Can I always just capitalize the first letter and prepend "on", or what is the algorithm?
Yes.
But I have not tried with dots in the name, though. But yes, everything which matches this regex is considered event handler, and then event name is generated here and attached with jQuery. So if dots are correctly parsed by Spacebars and if jQuery correctly attaches custom events, then it should work.
The issue is that I think jQuery uses dots for their namespacing of events, no?
Oh, those are namespaces what Bootstrap uses. So it should work.
Have you tried? Does it work?
Oh, sorry for not replying. Yes it works as you describe.
Maybe worth adding a sentence to the documentation to describe the algorithm.
Do you want to propose a sentence? Pull request?
Perfect, thanks!