Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Enabled morphing @event handlers #3494

Merged
merged 1 commit into from May 10, 2023
Merged

Conversation

ekwoka
Copy link
Contributor

@ekwoka ekwoka commented Mar 29, 2023

fixes #3493

This PR:

  • when needing to set @event attributes on elements during morph, transforms them into properly prefixed x-on: attributes instead
  • Tests the above behavior

@joshhanley
Copy link
Collaborator

@ekwoka in Livewire, we actually monkey patch the setAttribute method to allow @ symbols, see here https://github.com/livewire/livewire/blob/019b1e69d8cd8c7e749eba7a38e4fa69ecbc8f74/js/index.js#L142-L163

We're now using Alpine Morph for Livewire V3 and currently we're also monkey patching it there too.
I wonder whether it's worth adding something like that into the morph plugin instead?

@ekwoka
Copy link
Contributor Author

ekwoka commented Apr 3, 2023

It would make sense to have it live in Alpine morph. I'd probably not go with the monkey patching native behaviors though.

@calebporzio calebporzio merged commit 7f249c5 into alpinejs:main May 10, 2023
1 check passed
@calebporzio
Copy link
Collaborator

I already monkey patch .setAttribute to allow "@" symbols in Livewire so I'm pulling that over into Alpine to make this work. I scrapped your implementation, but kept your test. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants