Version 0.18.0
Released on with 19 commits
Compatible changes
- New UJS attribute
[up-toggle]to show or hide part of a form if certain options are selected or boxes are checked. - Links can now have an optional
up-confirmattribute. This opens a confirmation dialog with the given message before the link is followed or the modal/popup is opened. - New function
up.off(). This unregisters an event listener previously bound withup.on(). - If a container contains more than one link, you can now set the value of the
up-expandattribute to a CSS selector to define which link should be expanded. - You can now configure a list of safe HTTP methods in
up.proxy.config.safeMethods. The proxy cache will only cache safe requests and will clear the entire cache after a unsafe request. - Loading modals and popups will now open if there is a fragment update between the modal/popup's request and response.
up.follow()andup.replace()now have an option{ failTarget }. Use it to define the selector to replace if the server responds with an error.[up-target]and[up-follow]now have a modifying attribute[up-fail-target]. Use it to define the selector to replace if the server responds with an error.- New utility method
up.util.reject() - New utility method
up.util.only() - New utility method
up.util.except() - Fix a bug where modals could no longer be opened on some browsers
- When preventing an event emitted by an async function, that function now rejects its promise.
- Async functions that encounter an error now prefer to reject promises with an
Errorobject (instead of a string with the error message)
Breaking changes
-
⚠️ By default Unpoly now converts
PUT,PATCHandDELETErequests toPOSTrequests that carry their original method in a form parameter named_method. This is to prevent unexpected redirect behavior.Web frameworks like Ruby on Rails or Sinatra are aware of the
_methodparameter and use its value as the method for routing.You can configure this behavior in
up.proxy.config.wrapMethodsandup.proxy.config.wrapMethodParam. -
⚠️ The requested selector is now sent to the server as a request header
X-Up-Target(this used to beX-Up-Selector). If you are usingunpoly-rails, you can access it throughup.target(this used to beup.selector).