Replies: 1 comment
-
This is unlikely. Perhaps if a new event could be introduced that doesn't use jQuery, I would consider that to help. I'll move this to discussions for now. Thank you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Thansk for your work on this gem!
To start, I definitely understand that activeadmin is not actively looking to switch away from jQuery. That would be a massive effort. However, I think I've run into a particular problem that would justify moving away from jQuery events.
In our app, we have a guideline in place to avoid jQuery unless necessary. We wanted to add some JS code to listen for the
has_many_remove:before
event, so we added:however, that's never triggered. This does get triggered, though:
The reason is that has_many.js is calling jQuery's .trigger function here:
activeadmin/app/javascript/active_admin/initializers/has-many.js
Line 20 in 8c4c589
If we were able to switch all of the
trigger
calls todispatchEvent
, we could have both jQuery AND native event listeners to fire. However, because thetrigger
calls pass in arguments representing the item to remove and the parent element, I believe this would be a breaking change. Native events would have to store those elements in the event data'sdetail
property, while jQuery passes those elements as arguments to the listener function:I'm not sure if there's a way to make this a non breaking change (probably not?).
Would AA be willing to make this breaking change?
Beta Was this translation helpful? Give feedback.
All reactions