Revision code

Changes Version 0.57.0
Released on September 27, 2018 with 50 commits

Request parameters

To prevent confusion with [up-data], Unpoly now uses the word "params" when talking about form values or request parameters:

  • up.request() option { data } has been renamed to { params }.
  • up.replace() option { data } has been renamed to { params }.

Parameters may be passed in one of the following types:

  1. an object like { email: 'foo@bar.com' }
  2. a FormData object
  3. a query string like email=foo%40bar.com
  4. an array of { name, value } objects like [{ name: 'email', value: 'foo@bar.com' }]

To help working with form values and request parameters, an experimental module up.params has been added. It offers a consistent API to manipulate request parameters independent of their type.

Application layout

  • When Unpoly cannot find the viewport of an element, it now uses the scrolling root element. This is either <body> or <html>, depending on the browser.
  • Fix a bug where linking back and forth between multiple #anchor hashes of the same URL would always reveal the first anchor.
  • Revealing elements below fixed navigation bars now honors the navigation bar's padding, border, margin, top and bottom properties.
  • Fix a bug where revealing elements fixed navigation bars would scroll 1 pixel too short.
  • up.layout.revealHash() no longer retrieves the hash anchor from the current URL. You need to pass in a #hash value as a first argument.
  • Fix a bug where a #hash anchor would not be revealed if it included non-word characters like spaces or dots.

Compilers

  • To improve performance, Unpoly no longer parses [up-data] attributes when a compiler function does not require a second data argument.
  • Compilers that return destructor functions now run slightly faster.
  • Compilers with { batch: true } now receive an array of [up-data] objects as their second data argument.
  • Compilers with { batch: true } can no longer return destructor functions. Previously the behavior of batch destructors was undefined, now it throws an error.
  • Returning an array of destructor functions from up.compiler() is now deprecated. Please return a single destructor function instead.
  • up.syntax.data() now returns undefined if the given object has no (or an empty) [up-data] attribute. It previously returned an empty object.

Event listeners

  • To improve performance, Unpoly no longer parses [up-data] attributes when an up.on() listener does not require a third data argument.
  • up.on() now throws an error when the same callback function is registered multiple times.

Fragment update API

Various

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.