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:
{ email: 'foo@bar.com' }
email=foo%40bar.com
{ 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.
up.params.fromForm()
- serialize a <form>
up.params.fromURL()
- extract params from a URL's query stringup.params.toArray()
- convert any params type to an array of { name, value }
elementsup.params.toObject()
- convert any params type to an objectup.params.toQuery()
- convert any params type to a query stringup.params.toFormData()
- convert any params type to a FormData objectup.params.buildURL()
- composes a URL with query section from a base URL and a params value of any typeup.params.get()
- retrieve the value for the given params keyup.params.add()
- adds a single key/value to a params value of any typeup.params.assign()
- adds the params to another paramsup.params.merge()
- merges two params<body>
or <html>
, depending on the browser.#anchor
hashes of the same URL would always reveal the first anchor.padding
, border
, margin
, top
and bottom
properties.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.#hash
anchor would not be revealed if it included non-word characters like spaces or dots.[up-data]
attributes when a compiler function does not require a second data
argument.{ batch: true }
now receive an array of [up-data]
objects as their second data
argument.{ batch: true }
can no longer return destructor functions. Previously the behavior of batch destructors was undefined, now it throws an error.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.[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.up.all()
, which returns all elements matching the given selector. Like up.first()
it ignores elements that are being destroyed or transitioned.up.util.isBoolean()
.up.follow()
now accepts a { url }
option. It can be used to override the given link's [href]
attribute.up.form.config.submitButtons
up.preload()
now accepts an options hash that will be passed on to the function making the preload request.up.Response#getHeader()
. It looks up the header value for the given name in the HTTP response header.
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.