Affects Version/s: 3.9
Fix Version/s: None
I've been trying to solve an issue where I was previously listening for a native event and have had to update my code to listen for an Event generated by core/custom_interaction_events::trigger().
I have hit a snag because the two APIs are not compatible and lead to different results.
These are my findings so far:
The following trigger:
- only triggers to jQuery listeners - i.e. those added via a call like:
- provides any provided parameters ( e.g. 'Hello', 'Marvin', etc) as arguments after the Event, i.e.
The folloiwng trigger:
- Trigger both Vanilla listeners, and jQuery listeners. i.e. both of the following will be triggered:
- Passes the additional parameters in the detail element into the detail element of the eventual handler. e.g.
- They have a different API (detail vs. params)
- jQuery listens to vanilla events but does not trigger vanilla events
When we call element.trigger() we also generate a new CustomEvent with a different name
This works for the most part but is cumbersome:
- We need to generate an Event name for both
- For Vanilla listeners we need to listen for a different event name to allow for b/c
- Possible issues with stopImmediatePropagation on whichever event type is called first