v0.5.0
This release is focused on giving you more control over the request and rendering lifecycle of Alpine AJAX. To that end we've introduced a few new attributes and events. We've also revamped focus management to make it easier to control keyboard focus as content on the page changes. Lastly, we've made Alpine AJAX 30% smaller by decoupling our DOM morphing logic into a separate, optional, plugin.
Breaking Changes
1. x-focus
removed in favor of x-autofocus
In most situations you can remove x-focus
and add x-autofocus
to the element what was being targeted by x-focus
. In more complex situations you can listen for the new ajax:merged
event and do whatever you want with focus in the event handler.
2. Decoupled Morph into a separate plugin
If your project is using x-merge="morph"
install the Alpine Morph Plugin and you're good to go. Using the "morph" strategy without first installing the plugin will now throw an exception and prompt you to install the plugin. Our documentation examples have been updated to include install instructions when the Morph Plugin is required.
Additions
- Added a global
headers
configuration option for customizing request headers for every request - Added
x-headers
and$ajax
headers
option for customizing request headers per request #49 - Added
ajax:merge
andajax:merged
events for customizing and reacting to merged content #62 - Added
x-autofocus
to declarative control keyboard focus after content is merged #56 - Added
x-target.nofocus
modifier to disable autofocus behavior
Fixes
- Changed the default
enctype
for AJAX requests toapplication/x-www-form-urlencoded
in #61 - Elements with
autofocus
will be focused after a merge #56 - Form submissions now respect
formaction
andformmethod
attributes #60 - Right clicking a link won't fire an AJAX requests #59
- History is updated before merging content so that relative URLs resolve correctly #58
Full Changelog: v0.4.3...v0.5.0