mojarra
mojarra copied to clipboard
Automatically pass through all on* event attributes
https://github.com/jakartaee/faces/issues/1507
With this PR, the following finally works for any on* event attribute and f:ajax event="..." without need to register event name as a new attribute in component as long as the event name is covered by ClientBehaviorHolder#getEventNames():
<h:inputText oninput="...">
<f:ajax event="input" ... />
</h:inputText>
Done so far:
- New
jakarta.faces.component.html.HtmlEventshelper class for managing all these attributes - Mojarra impl has been adjusted
- updated
ClientBehaviorHolder#getEventNames()to catch up current standard (without the need to add new attribute getter/setter pairs!) - add context param which makes it possible to add new event names so it doesn't anymore throw exception on them:
jakarta.faces.ADDITIONAL_HTML_EVENT_NAMES, defined in newjakarta.faces.component.html.HtmlEventsclass - set in stone in Faces spec: https://github.com/eclipse-ee4j/mojarra/pull/5325/commits/7236717db399cb08aeb23331c5f16d83911e8913
TODO:
- discuss in https://github.com/jakartaee/faces/issues/1507 if this is ok
- perhaps add
ClientBehaviorHolder#setOn(name, value)andgetOn(name)so these can be programmatically set/get (even thoughgetPassthroughAttributes()can always be used for this) - discuss what to do with existing getters/setters of on* attributes, should we deprecate these?
looks good for me
@volosied @melloware can you also give a look plz?
I like it. This is a big change but it will be a good one for 5.0. I will have to study the MyFaces code on exactly where to put this stuff.
Sorry, didn't see the notifications until now. I'll take a look at this tomorrow or Tuesday!
API part of original PR is split into https://github.com/jakartaee/faces/pull/1880