Closed VincentToups closed 11 years ago
Why can you not add your blur listener to the DOM element of interest?
This is a possible work around, but it breaks the uniformity of the code somewhat. Given that maria provides a single place to describe all event dispatching, it would be nice if we could describe all possible event dispatching descriptions in one place.
You can add blur listeners to events that are in the template. Based on your other ticket, I think you may have a design that is fighting against the Maria way of doing things. Your element that you want to watch for blur is not in the template. I would likely make another view called app.EditorView
that has the <input>
in the template and then instantiate one of these views when I need it.
If you want to have the <input>
in the same template as the <div>
you can do it like I did in TodoMVC...
You may be right about developing against the maria grain - I'll try both approaches you described.
On Mon, Jul 22, 2013 at 5:31 PM, Peter Michaux notifications@github.comwrote:
If you want to have the in the same template as the
you can do it like I did in TodoMVC...— Reply to this email directly or view it on GitHubhttps://github.com/petermichaux/maria/issues/63#issuecomment-21352263 .
Please reopen if you have more to discuss.
blur
events do not bubble, and all browsers apart from Firefox implement thefocusout
event, which is has this property. In Firefox, one can simulate the this behavior by calling addEventHandler with an optional argument,useCapture
to true. However, when declaring uiActions in Maria, there is no way to express the intent to set useCapture to true, so focusout behavior is inaccessible.One can override the
buildUIActions
method but a complete implementation involves deep modification of code all the way down into evento.on. It isn't clear what the ramifications of such a modification are.Perhaps an alternative for maria is to specify an array of the form ["selector" ,useCapture] as the key in uiActions and then having Maria set the correct useCapture value.