Revision code

Changes Version 0.18.0
Released on February 09, 2016 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-confirm attribute. 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 with up.on().
  • If a container contains more than one link, you can now set the value of the up-expand attribute 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() and up.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 Error object (instead of a string with the error message)

Breaking changes

  • By default Unpoly now converts PUT, PATCH and DELETE requests to POST requests 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 _method parameter and use its value as the method for routing.

    You can configure this behavior in up.proxy.config.wrapMethods and up.proxy.config.wrapMethodParam.

  • The requested selector is now sent to the server as a request header X-Up-Target (this used to be X-Up-Selector). If you are using unpoly-rails, you can access it through up.target (this used to be up.selector).

Upgrading

If you're upgrading from an older Unpoly version you should load unpoly-migrate.js to polyfill deprecated APIs. Changes handled by unpoly-migrate.js are not considered breaking changes.

See our upgrading guide for details.