mojarra icon indicating copy to clipboard operation
mojarra copied to clipboard

Automatically pass through all on* event attributes

Open BalusC opened this issue 2 years ago • 4 comments
trafficstars

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.HtmlEvents helper 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 new jakarta.faces.component.html.HtmlEvents class
  • 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) and getOn(name) so these can be programmatically set/get (even though getPassthroughAttributes() can always be used for this)
  • discuss what to do with existing getters/setters of on* attributes, should we deprecate these?

BalusC avatar Sep 30 '23 17:09 BalusC

looks good for me

@volosied @melloware can you also give a look plz?

tandraschko avatar Oct 30 '23 09:10 tandraschko

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.

melloware avatar Oct 30 '23 11:10 melloware

Sorry, didn't see the notifications until now. I'll take a look at this tomorrow or Tuesday!

volosied avatar Nov 12 '23 17:11 volosied

API part of original PR is split into https://github.com/jakartaee/faces/pull/1880

BalusC avatar Feb 10 '24 21:02 BalusC