---
area: "Changes"
parent: "Changes"
url: "https://unpoly.com/changes/3.0.0"
released: "2023-04-17"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [Changes](https://unpoly.com/changes.md)</nav>

# Version 3.0.0

Released on April 17, 2023 with [905 commits](https://github.com/unpoly/unpoly/commits/v3.0.0)

<nav aria-label="Contents">

- [Overview](#overview)
- [Upgrade effort](#upgrade-effort)
- [Fragments](#fragments)
- [Custom JavaScript](#custom-javascript)
- [Layers](#layers)
- [Passive updates](#passive-updates)
- [Navigation feedback](#navigation-feedback)
- [Logging](#logging)
- [History](#history)
- [Scrolling](#scrolling)
- [Focus](#focus)
- [Forms](#forms)
- [Network requests](#network-requests)
- [Utility functions](#utility-functions)
- [DOM helpers](#dom-helpers)
- [Animation](#animation)
- [Reworked documentation](#reworked-documentation)
- [Migration polyfills](#migration-polyfills)
- [Framework](#framework)
- [Dropped support for legacy technologies](#dropped-support-for-legacy-technologies)
- [Upgrading](#upgrading)

</nav>

## Overview {#overview}

The main concern of Unpoly 3 is to **fix all the concurrency issues** arising from real-world production use:

- Forms where many fields depend on the value of other fields
- Multiple users working on the same backend data (stale caches)
- User clicking faster than the server can respond
- Multiple requests targeting the same fragment
- Responses arrives in different order than requests
- User losing connection while requests are in flight
- Lie-Fi (spotty Wi-Fi, EDGE, tunnel)

Unpoly 3 also ships numerous **quality of life improvements** based on community feedback:

- Optional targets
- Idempotent [`up.hello()`](https://unpoly.com/api/up.hello.md)
- More control over [`[up-hungry]`](https://unpoly.com/api/up-hungry.md)
- HTML5 data attributes
- Extensive render callbacks
- Strict target derivation
- Cleaner logging
- Foreign overlays

In addition to this CHANGELOG, there is also a [slide deck](http://triskweline.de/unpoly3-slides/) explaining the most relevant changes in more detail.

Finally we have [reworked Unpoly's documentation](#reworked-documentation) in our ongoing efforts to evolve it an API reference to a long-form guide.

## Upgrade effort {#upgrade-effort}

- The upgrade from Unpoly 2 to 3 will be _much_ smoother than going from Unpoly 1 to 2. We were able to upgrade multiple medium-sized apps in less than a day's work. As always, [YMMV](https://www.urbandictionary.com/define.php?term=ymmv).
- No changes were made in HTML or CSS provided by Unpoly.
- Most breaking changes are polyfilled by [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading.md), which automatically logs instructions for migrating affected code.
- Changes that may need your attention are marked with 🧩 when `unpoly-migrate.js` polyfills them and logs where you use the old API, with ⚠️ when they are not polyfilled but rare or minor, and with ❌ when you should check your code in any case.
- `unpoly-migrate.js` keeps polyfills for deprecated APIs going back to 2016. You may upgrade from v1 to v3 without going through v2 first.

## Fragments {#fragments}

### Concurrent updates to the same fragment {#concurrent-updates-to-the-same-fragment}

When a user clicks faster than a server can respond, multiple concurrent requests may be [targeting](https://unpoly.com/learn/targeting-fragments.md) the fragments. Over the years Unpoly has attempted different strategies to deal with this:

- Unpoly 1 did not limit concurrent updates. This would sometimes lead to race conditions where concurrent responses were updating fragments out of order.
- Unpoly 2 by default aborted _everything_ on [navigation](https://unpoly.com/learn/navigation-defaults.md). While this would guarantee the last update matching the user's last interaction, it sometimes killed background requests (e.g. the preloading of a large navigation menu).
- Unpoly 3 by default only aborts requests conflicting with your update. Requests targeting other fragments are not aborted. See a [visual example here](https://unpoly.com/learn/aborting-requests.md#aborting-conflicting-requests).

That said, Unpoly 3 makes the following changes to the way conflicting fragment updates are handled:

- 🧩 The render option `{ solo }` was replaced with a new option `{ abort }`.

- 🧩 The HTML attribute `[up-solo]` was replaced with a new attribute `[up-abort]`.

- A new default render option is `{ abort: 'target' }`. This [aborts earlier requests](https://unpoly.com/learn/aborting-requests.md) targeting fragments within _your_ targeted fragments.

  For instance, the following would abort all requests targeting `.region` (or a descendant of `.region`) when the link is clicked:

  ```html
  <a href="/path" up-target=".region">
  ```

  ⚠️ If your Unpoly 2 app uses a lot of `{ solo: false }` options or `[up-solo=false]` attributes, these may no longer be necessary now that Unpoly 3 is more selective about what it aborts.

- To programmatically abort all requests targeting fragments in a region, use [`up.fragment.abort(selector)`](https://unpoly.com/api/up.fragment.abort.md).

- ⚠️ Unpoly now cancels timers and other async work when a fragment is aborted by being [targeted](https://unpoly.com/learn/targeting-fragments.md):
  - [Polling](https://unpoly.com/api/up-poll.md) now stops when the fragment is aborted.
  - Pending [validations](https://unpoly.com/learn/validation.md) are now aborted when an observed field is aborted.
  - When a fragment is destroyed or updated, pending requests targeting that fragment will always be aborted, regardless of the `{ abort }` option.

- Your own code may react to a fragment being aborted by being targeted. To so, listen to the new [`up:fragment:aborted`](https://unpoly.com/api/up:fragment:aborted.md) event.

- To simplify observing an element and its ancestors for aborted requests, the function [`up.fragment.onAborted()`](https://unpoly.com/api/up.fragment.onAborted.md) is also provided.

- Fragment updates may exempt their requests from being aborted by setting an `[up-abortable=false]` attribute on the updating link, or by passing an `{ abortable: false }` render option.

- Imperative preloading with [`up.link.preload()`](https://unpoly.com/api/up.link.preload.md) is no longer abortable by default.

  This makes it easy to eagerly preload links like this:

  ```js
  up.compiler('a[rel=next]', up.link.preload)
  ```

  You can make preload requests abortable again by passing an `{ abortable: true }` option.

- ⚠️ The option [`up.request({ solo })`](https://unpoly.com/api/up.request.md) was removed. To abort existing requests, use [`up.fragment.abort()`](https://unpoly.com/api/up.fragment.abort.md) or [`up.network.abort()`](https://unpoly.com/api/up.network.abort.md).

### Optional targets {#optional-targets}

Target selectors can now mark optional fragments as [`:maybe`](https://unpoly.com/api/maybe.md).

For example, the following link will update the fragments `.content` (required) and `.details` (optional):

```html
<a href="/cards/5" up-target=".content, .details:maybe">...</a>
```

### Strict target derivation {#strict-target-derivation}

Unpoly often needs to [derive a target selector](https://unpoly.com/learn/target-derivation.md) from an element, e.g. for [`[up-hungry]`](https://unpoly.com/api/up-hungry.md), [`[up-poll]`](https://unpoly.com/api/up-poll.md) or [`up.reload(element)`](https://unpoly.com/api/up.reload.md). Unpoly 2 would sometimes guess the wrong target, causing the wrong fragment to be updated. This is why target derivation has been reworked to be more strict in Unpoly 3:

- ⚠️ A longer, but stricter list of possible patterns is used to [derive a target selector](https://unpoly.com/learn/target-derivation.md).

  The following patterns are configured by default:

  ```js
  up.fragment.config.targetDerivers = [
    '[up-id]',        // [up-id="foo"]
    '[id]',           // #foo
    'html',           // html
    'head',           // head
    'body',           // body
    'main',           // main
    '[up-main]',      // [up-main="root"]
    'link[rel]',      // link[rel="canonical"]
    'meta[property]', // meta[property="og:image"]
    '*[name]',        // input[name="email"]
    'form[action]',   // form[action="/users"]
    'a[href]',        // a[href="/users/"]
    '[class]',        // .foo (filtered by up.fragment.config.badTargetClasses)
  ]
  ```

  Note that an element's tag name is no longer considered a useful target selector, except for unique elements like `<body>` or `<main>`.

- ⚠️ Before a target selector is used, Unpoly 3 will verify whether it would actually match the targeted element.

  If it matches another element, another target derivation pattern is attempted. If no pattern matches, an error `up.CannotTarget` is thrown.

  If you see an `up.CannotTarget` error while upgrading to Unpoly 3, this probably indicates a bug in your app concerning elements with ambiguous selectors. You should fix it by giving those elements a unique `[id]` attribute.

  Verification of derived targets may be disabled with `up.fragment.config.verifyDerivedTarget = false`.

- [`[up-poll]`](https://unpoly.com/api/up-poll.md) will only work on elements for which we can derive a good target selector.

- [`[up-hungry]`](https://unpoly.com/api/up-hungry.md) will only work on elements for which we can derive a good target selector.

- Added a new function [`up.fragment.isTargetable()`](https://unpoly.com/api/up.fragment.isTargetable.md). It returns whether we can derive a good target selector for the given element.

- When [`up.fragment.toTarget()`](https://unpoly.com/api/up.fragment.toTarget.md) is called with a string, the string is now returned unchanged.

### Keepable elements {#keepable-elements}

- [`[up-keep]`](https://unpoly.com/api/up-keep.md) now preserves the playback state of started `<audio>` or `<video>` elements.
- You may now use [`[up-keep]`](https://unpoly.com/api/up-keep.md) within [`[up-hungry]`](https://unpoly.com/api/up-hungry.md) elements (reported by [@foobear](https://github.com/foobear)).
- 🧩 The event [`up:fragment:kept`](https://unpoly.com/api/up:fragment:kept.md) was removed. There is still [`up:fragment:keep`](https://unpoly.com/api/up:fragment:keep.md).
- 🧩 The render option `{ keep }` was renamed to `{ useKeep }`. An `[up-use-keep]` attribute for links and forms was added.
- 🧩 Setting the value of [`[up-keep]`](https://unpoly.com/api/up-keep.md) to a selector for matching new content is no longer supported

### Extensive render hooks {#extensive-render-hooks}

Unpoly 3 expands your options to [hook into specific stages](https://unpoly.com/learn/render-lifecycle.md) of the rendering process in order to change the result or handle error cases:

- Rendering functions now accept a wide range of callback functions. Using a callback you may intervene at many points in the rendering lifecycle:

  ```js
  up.render({
    url: '/path',
    onLoaded(event)        { /* Content was loaded from cache or server */ },
    focus(fragment, opts)  { /* Set focus */ },
    scroll(fragment, opts) { /* Set scroll positions */ },
    onRendered(result)     { /* Fragment was updated */ },
    onFailRendered(result) { /* Fragment was updated from failed response */ },
    onRevalidated(result)  { /* Stale content was re-rendered */ },
    onFinished(result)     { /* All finished, including animation and revalidation */ }
    onOffline(event)       { /* Disconnection or timeout */ },
    onError(error)         { /* Any error */ }
  })
  ```

- Callbacks may also be passed as HTML attributes on links or forms, e.g. `[up-on-rendered]` or `[up-on-error]`.

- To run code after all DOM changes have concluded (including animation and revalidation), you may now `await up.render().finished`. The existing callback `{ onFinished }` remains available.

- The [`up:fragment:loaded`](https://unpoly.com/api/up:fragment:loaded.md) event has new properties `{ revalidating, expiredRequest }`. This is useful to handle [revalidation](https://unpoly.com/learn/caching.md#revalidation) requests.

- The [`up:fragment:loaded`](https://unpoly.com/api/up:fragment:loaded.md) gets a new `event.skip()` which finishes the render pass without changes. Programmatic callers are fulfilled with an empty [`up.RenderResult`](https://unpoly.com/api/up.RenderResult.md). This is in contrast to `event.preventDefault()`m which aborts the render pass and rejects programmatic callers with an `up.AbortError`.

- You may use [`up.fragment.config.skipResponse`](https://unpoly.com/api/up.fragment.config.md#config.skipResponse) to configure global rules for responses that should be skipped. By default Unpoly skips:
  - Responses without text in their body.

    Such responses occur when a [conditional request](https://unpoly.com/learn/conditional-requests.md) in answered with HTTP status `304 Not Modified` or `204 No Content`.
  - When [revalidating](https://unpoly.com/learn/caching.md#revalidation), if the expired response and fresh response have the exact same text.

- 🧩 Callbacks to handle [failed responses](https://unpoly.com/learn/error-responses.md), now begin with the prefix `onFail`, e.g. `{ failOnFinished }` becomes `{ onFailFinished }`.

### Various changes {#various-changes}

- 🧩 You may now target the origin origin using [`:origin`](https://unpoly.com/api/origin.md). The previous shorthand `&` has been deprecated.
- ⚠️ When Unpoly uses the `{ origin }` to [resolve ambiguous selectors](https://unpoly.com/learn/targeting-fragments.md#ambiguous-selectors), that origin is now also rediscovered in the server response. If the origin could be rediscovered, Unpoly prefers matching new content closest to that.
- Added a new property [`up.RenderResult#fragment`](https://unpoly.com/api/up.RenderResult.prototype.fragment.md) which returns the first updated fragment.
- ⚠️ The property [`up.RenderResult#fragments`](https://unpoly.com/api/up.RenderResult.prototype.fragments.md) now only contains newly rendered fragments. It will no longer contain:
  - [Kept](https://unpoly.com/api/up-keep.md) elements.
  - Existing fragments that got new content appended or prepended.
  - Existing fragments that had their inner HTML replaced (`{ content }`).
- New experimental function [`up.fragment.matches()`](https://unpoly.com/api/up.fragment.matches.md). It returns whether the given element matches the given CSS selector or other element.
- The function [`up.fragment.closest()`](https://unpoly.com/api/up.fragment.closest.md) is now stable.
- Fix a memory leak where swapping an element did not [clear internal jQuery caches](https://makandracards.com/makandra/31325-how-to-create-memory-leaks-in-jquery).
- Support prepending/appending content when rendering from a string using [`up.render({ content })`](https://unpoly.com/api/up.render.md) and [`up.render({ fragment })`](https://unpoly.com/api/up.render.md).
- When prepending/appending content you may now also target `::before` and `::after` pseudos (double colon) in addition to `:before` and `:after`.
- New fragments may now have HTML attributes containing the verbatim string `<script>` (fixes [#462](https://github.com/unpoly/unpoly/issues/462))

## Custom JavaScript {#custom-javascript}

### Attaching data to elements {#attaching-data-to-elements}

Unpoly 3 makes it easier to work with [element data](https://unpoly.com/learn/data.md):

- Simple data key/values can now be attached to an element using standard HTML5 `[data-*]` attributes (in addition to [`[up-data]`](https://unpoly.com/api/up-data.md)).

- The data argument passed to a compiler is merged from both `[data-*]` and [`[up-data]`](https://unpoly.com/api/up-data.md) attributes. These three elements produce the same compiler data:

  ```html
  <div up-data='{ "foo": "one", "bar": "two" }'></div>
  <div data-foo='one' data-bar='two'></div>
  <div up-data='{ "foo": "one" }' data-bar='bar'></div>
  ```

- When reloading or validating, element data can now be forwarded with a `{ data }` option:
  - New option [`up.render({ data })`](https://unpoly.com/api/up.render.md)
  - New option [`up.reload({ data })`](https://unpoly.com/api/up.reload.md)
  - New option [`up.validate({ data })`](https://unpoly.com/api/up.validate.md)

- When reloading or validating, element data can now be preserved with a `{ keepData }` option:
  - New option [`up.reload({ keepData })`](https://unpoly.com/api/up.reload.md)
  - New option [`up.validate({ keepData })`](https://unpoly.com/api/up.validate.md)
  - [`[up-poll]`](https://unpoly.com/api/up-poll.md) gets a new attribute `[up-keep-data]`

### Compilers {#compilers}

- [`up.hello()`](https://unpoly.com/api/up.hello.md) is now idempotent.

  You can call [`up.hello()`](https://unpoly.com/api/up.hello.md) on the same element tree multiple times without the fear of side effects.

  Unpoly guarantees that each compiler only ever runs once for a matching elements.

- You can now register compilers after content was rendered.

  New compilers registered after booting automatically run on current elements. This makes it easier to split your compilers into multiple files that are then loaded as-needed.

  Note that compilers with a `{ priority }` will only be called for new content, but not for existing content.

- Compilers now accept an optional third argument with information about the current render pass:

  ```js
  up.compiler('.user', function(element, data, meta) {
    console.log(meta.response.text.length)        // result: 160232
    console.log(meta.response.header('X-Course')) // result: "advanced-ruby"
    console.log(meta.layer.mode)                  // result: "root"
    console.log(meta.revalidating)                // result: true
  })
  ```

- ⚠️ When a render pass updates multiple fragments, Unpoly now swaps and compiles them in reverse order of the target. A compiler in a later target runs before earlier targets are updated, so it sees their old content. _(Documented and changed again in [3.15](https://unpoly.com/changes/3.15.0.md).)_

### Various changes {#various-changes-1}

- ⚠️ Unpoly now executes `<script>` tags in new fragments. (Changed again in [3.11](https://unpoly.com/changes/3.11.0.md) and [3.14](https://unpoly.com/changes/3.14.0.md).)

  You may disable this behavior with `up.fragment.config.runScripts = false` (this was the default in Unpoly 2).

  Note if you include your application bundle in your `<body>` it may now be executed multiple times if you're swapping the `<body>` element with Unpoly. We recommend [moving your `<script>` tags into the head with `<script defer>`](https://makandracards.com/makandra/504104-you-should-probably-load-your-javascript-with-script-defer).

- ⚠️ When a compiler throws an error, rendering functions like [`up.render()`](https://unpoly.com/api/up.render.md) or [`up.submit()`](https://unpoly.com/api/up.submit.md) now reject with an error.

- Fixed a bug where matching elements in the `<head>` were not compiled during the initial page load.

## Layers {#layers}

### Foreign overlays {#foreign-overlays}

The [overlays](https://unpoly.com/api/up.layer.md) of Unpoly 2 would sometimes clash with overlays from a third party library ("foreign overlay"). E.g. clicking a foreign overlay would closes an Unpoly overlay, or Unpoly would steal focus from a foreign overlay.

Unpoly 3 lets you configure selectors matching foreign overlays using [`up.layer.config.foreignOverlaySelectors`](https://unpoly.com/api/up.layer.config.md#config.foreignOverlaySelectors). Within a foreign overlay Unpoly will no longer have opinions regarding layers or focus.

### Various changes {#various-changes-2}

- Fixed a bug where referring to the root layer by index ([`up.fragment.get(selector, { layer: 0 })`](https://unpoly.com/api/up.fragment.get.md)) would always match in the current layer instead of the root layer.
- The [`up:layer:location:changed`](https://unpoly.com/api/up:layer:location:changed.md) now has a property `{ layer }`. It returns the layer that had its location changed.

## Passive updates {#passive-updates}

### Hungry elements {#hungry-elements}

- You may now update [`[up-hungry]`](https://unpoly.com/api/up-hungry.md) elements for updates of any layer by setting an `[up-if-layer=any]` attribute.

  A use case for this are notification flashes that are always rendered within the application layout on the root layer.

- You may now restrict updating of [`[up-hungry]`](https://unpoly.com/api/up-hungry.md) elements for updates that change history by setting an `[up-if-history]` attribute.

  A use case is a `<link rel="canonical">` element that is related to the current history entry.

- 🧩 The render option `{ hungry }` was renamed to `{ useHungry }`. An `[up-use-hungry]` attribute for links and forms was added.

- You may now use [`[up-keep]`](https://unpoly.com/api/up-keep.md) within [`[up-hungry]`](https://unpoly.com/api/up-hungry.md) elements (reported by [@foobear](https://github.com/foobear)).

### Polling {#polling}

- Polling is no longer disabled on poor connections. Instead the polling frequency is halved. This can be figured in `up.radio.config.stretchPollInterval`.
- [`[up-poll]`](https://unpoly.com/api/up-poll.md) now prints fatal errors to the log.
- [`[up-poll]`](https://unpoly.com/api/up-poll.md) now logs a message when it skips polling, e.g. when the tab is hidden or a fragment is on a background layer.
- [`[up-poll]`](https://unpoly.com/api/up-poll.md) gets new attribute `[up-keep-data]` to preserve the [data](https://unpoly.com/learn/data.md) of the polling fragment

## Navigation feedback {#navigation-feedback}

- Targeted fragments are now marked with an [`.up-loading`](https://unpoly.com/api/up-loading.md) class while a request is loading.

  By styling elements with this class you can highlight the part of the screen that's loading.

  Note that [`.up-loading`](https://unpoly.com/api/up-loading.md) is added in addition to the existing [`.up-active`](https://unpoly.com/api/up-active.md) class, which is assigned to the link, form or field that triggered a request.

## Logging {#logging}

- The log now shows which user interaction triggered an event chain.
- [`up.emit()`](https://unpoly.com/api/up.emit.md) now only prints user events when the user has enabled logging.
- Unpoly now logs when an event like [`up:link:follow`](https://unpoly.com/api/up:link:follow.md) or [`up:form:submit`](https://unpoly.com/api/up:form:submit.md) has prevented a render pass.
- Unpoly now logs when there was no new content to render.
- Unpoly now logs when we're rendering a [failed response](https://unpoly.com/learn/error-responses.md) using fail-prefixed options.

## History {#history}

- Unpoly now emits an event [`up:location:restore`](https://unpoly.com/api/up:location:restore.md) when the user is [restoring a previous history entry](https://unpoly.com/learn/restoring-history.md), usually by pressing the back button.

  Listeners may prevent [`up:location:restore`](https://unpoly.com/api/up:location:restore.md) and substitute their own restoration behavior.

- 🧩 Renamed [`up:location:changed`](https://unpoly.com/api/up:location:changed.md) event's `{ url }` property to `{ location }`.

- Fix a bug where clicking links twice would not update location when the browser history API is used in between (closes [#388](https://github.com/unpoly/unpoly/issues/388)).

## Scrolling {#scrolling}

- Smooth scrolling with `{ behavior: 'smooth' }` now uses the browser's native smooth scrolling implementation.

  This gives us much better performance, at the expense of no longer being able to control the scroll speed, or the detect the end of the scrolling motion.

- 🧩 Removed property `up.viewport.config.scrollSpeed` without replacement.

- ⚠️ Removed the option `{ scrollSpeed }` without replacement.

- 🧩 [`up.reveal()`](https://unpoly.com/api/up.reveal.md) no longer returns a promise for the end of a smooth scrolling animation.

- ⚠️ [`up.viewport.restoreScroll()`](https://unpoly.com/api/up.viewport.restoreScroll.md) no longer returns a promise for the end of a smooth scrolling animation. Instead if returns a boolean value indicating whether scroll positions could be restored

- ⚠️ Instant (non-smooth) scrolling is now activated using `{ behavior: 'instant' }` instead of `{ behavior: 'auto' }`.

- You may now attempt multiple [scrolling strategies](https://unpoly.com/learn/scrolling.md) in an `[up-scroll]` attribute.

  The strategies can be separated by an `or` e.g. `[up-scroll="hash or :main"]`. Unpoly will use the first applicable strategy.

- You may now pass alternate strategies when scroll position could not be restored.

  E.g. `{ scroll: ['restore', 'main' ] }` or `[up-scroll="restore or main"]`

- Fix a bug where when attempting to restore scroll positions that were never saved for the current URL, all scroll positions were reset to zero.

- When a render pass results in no new content, the `{ scroll }` option now is still processed.

- When [scrolling to a fragment](https://unpoly.com/learn/scrolling.md#target), [obstructing elements](https://unpoly.com/learn/scroll-tuning.md#fixed-layout-elements-obstructing-the-viewport) that are hidden are now ignored.

## Focus {#focus}

- You may now attempt multiple [focus strategies](https://unpoly.com/learn/focus.md) in an `[up-focus]` attribute.

  The strategies can be separated by an `or` e.g. `[up-focus="hash or :main"]`. Unpoly will use the first applicable strategy.

- Focus is now saved and restored when navigating through history:
  - Saved state includes the cursor position, selection range and scroll position of the focused element.
  - To explicitly save focus for the current URL, use [`up.viewport.saveFocus()`](https://unpoly.com/api/up.viewport.saveFocus.md).
  - To opt out of the focus saving, [`up.render({ saveFocus: false })`](https://unpoly.com/api/up.render.md)
  - Th explicitly _restore_ focus for the current URL, use [`up.viewport.restoreFocus()`](https://unpoly.com/api/up.viewport.restoreFocus.md).
  - To opt out of the focus restoration, use [`up.render({ focus: false })`](https://unpoly.com/api/up.render.md).

- When rendering without navigation or an explicit [focus strategy](https://unpoly.com/learn/focus.md), Unpoly will now preserve focus by default.

- Links with an [`[up-instant]`](https://unpoly.com/api/up-instant.md) attribute are now focused when being followed on `mousedown`. This is to mimic the behavior of standard links.

- When a render pass finishes [without new content](https://unpoly.com/learn/conditional-requests.md#rendering-nothing), the `{ focus }` option now is still processed.

- Fix a bug where focus loss was not detected when it occurred in a secondary fragment in a multi-fragment update.

- `<label for="id">` elements now always focus a matching field in the same layer, even when fields with the same IDs exist in other layers.

## Forms {#forms}

### Preventing concurrent form interaction {#preventing-concurrent-form-interaction}

- Forms [can now be disabled](https://unpoly.com/learn/disabling-forms.md) while they are submitting. To do so set an `[up-disable]` attribute to the `<form>` element or pass a `{ disable }` option to a render function.

  By default all fields and buttons in that forms are disabled.

  To only disable submit buttons, pass a selector like `[up-disable="button"]`.

  To only disable some fields or buttons, pass a selector that matches these fields or their container, e.g. `[up-disable=".money-fields"]`).

- Fields being observed with [`[up-validate]`](https://unpoly.com/api/up-validate.md) and [`[up-watch]`](https://unpoly.com/api/up-watch.md) may also disable form elements using an `[up-watch-disable]` attribute:

  ```html
  <select up-validate=".employees" up-watch-disable=".employees">
  ```

### Batched validation for forms where everything depends on everything {#batched-validation-for-forms-where-everything-depends-on-everything}

Sometimes we don't want to disable forms while working, either because of optics (gray fields) or to not prevent user input.

Unpoly 3 has a **second** solution for forms with many [`[up-validate]`](https://unpoly.com/api/up-validate.md) dependencies that does not require disabling:

- ⚠️ Multiple elements targeted by [`[up-validate]`](https://unpoly.com/api/up-validate.md) are now batched into a single render pass with multiple targets. Duplicate or nested target elements are consolidated.

  This behavior cannot be disabled.

- Validation will only have a single concurrent request at a time. Additional validation passes while the request is in flight will be queued.

- Form will eventually show a consistent state, regardless how fast the user clicks or how slow the network is.

See [Reactive server forms](https://unpoly.com/learn/reactive-server-forms.md) for a full example.

### Watching fields for changes {#watching-fields-for-changes}

Various changes make it easier to watch fields for changes:

- 🧩 The function [`up.observe()`](https://unpoly.com/api/up.observe.md) has been renamed to [`up.watch()`](https://unpoly.com/api/up.watch.md).
- 🧩 The attribute [`[up-observe]`](https://unpoly.com/api/up-observe.md) has been renamed to [`[up-watch]`](https://unpoly.com/api/up-watch.md).
- Added [many options](https://unpoly.com/learn/watch-options.md) to control [watching](https://unpoly.com/api/up-watch.md), [validation](https://unpoly.com/learn/validation.md) and [auto-submission](https://unpoly.com/api/up-autosubmit.md):
  - You can now control which events are observed by setting an `[up-watch-event]` attribute or by passing a `{ watch }` option.
  - You can now control whether to show [navigation feedback](https://unpoly.com/api/up.status.md) while an async callback is working by setting an `[up-watch-feedback]` attribute or by passing a `{ feedback }` option.
  - You can now debounce callbacks by setting an `[up-watch-delay]` attribute or by passing a `{ delay }` option.
  - You can now [disable form fields](https://unpoly.com/learn/watch-options.md#disabling) while an async callback is working by setting an `[up-watch-deisable]` attribute or by passing a `{ disable }` option.
  - All these options can be used on individual fields or [set as default for multiple fields](https://unpoly.com/learn/watch-options.md#multiple-fields) or entire forms.
- Delayed callbacks no longer run when the watched field was _removed_ from the DOM during the delay (e.g. by the user navigating away)
- Delayed callbacks no longer run when the watched field was _aborted_ during the delay (e.g. by the user submitting the containing form)
- Sometimes fields emit non-standard events instead of `change` and `input`. You may now use [`up.form.config.watchInputEvents`](https://unpoly.com/api/up.form.config.md#config.watchInputEvents) and `up.form.config.watchCangeEvents` to normalize field events so they become observable as `change` or `input`.
- Date inputs (`<input type="date">`) are now (by default) validated on `blur` rather than on `change` (fixes [#336](https://github.com/unpoly/unpoly/issues/336)).
- 🧩 The configuration `up.form.config.observeDelay` has been renamed to [`up.form.config.watchInputDelay`](https://unpoly.com/api/up.form.config.md#config.watchInputDelay).
- The `this` in an [`[up-watch]`](https://unpoly.com/api/up-watch.md) callback is now always bound to the element that has the attribute (fixes [#442](https://github.com/unpoly/unpoly/issues/442)).
- 🧩 The [`up.watch()`](https://unpoly.com/api/up.watch.md) function (formerly [`up.observe()`](https://unpoly.com/api/up.observe.md)) no longer accepts an array of elements. It only accepts a single field, or an element containing multiple fields.

### Various changes {#various-changes-3}

- ⚠️ The [`up.validate()`](https://unpoly.com/api/up.validate.md) function now rejects when the server responds with an error code.
- The [`up:form:validate`](https://unpoly.com/api/up:form:validate.md) event has a new property `{ params }`. Listeners may inspect or mutate params before they are sent.
- New function [`up.form.submitButtons(form)`](https://unpoly.com/api/up.form.submitButtons.md) that returns a list of submit buttons in the given form.
- New function [`up.form.group(input)`](https://unpoly.com/api/up.form.group.md) that returns the form group (tuples of label, input, error, hint) for the given input element.
- 🧩 Replaced [`[up-fieldset]`](https://unpoly.com/api/up-fieldset.md) with [`[up-form-group]`](https://unpoly.com/api/up-form-group.md).
- 🧩 Replaced `up.form.config.validateTargets` with [`up.form.config.groupSelectors`](https://unpoly.com/api/up.form.config.md#config.groupSelectors). Configured selectors must no longer contain a `:has(:origin)` suffix, as this is now added automatically when required.
- All functions with a `{ params }` option now also accept a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) value.
- The [`[up-show-for]`](https://unpoly.com/api/up-show-for.md) and [`[up-hide-for]`](https://unpoly.com/api/up-hide-for.md) attributes now accept values with spaces. Such values must be encoded as a JSON array, e.g. `<element up-show-for='["John Doe", "Jane Doe"]'>`. Fixes [#78](https://github.com/unpoly/unpoly/issues/78).
- ❌ When submitting a form, `{ origin }` is now the element that triggered the submission:
  - When a form is submitted, the [`:origin`](https://unpoly.com/api/origin.md) is now the submit button (instead of the `<form>` element)
  - When a form is submitted by pressing `Enter` within a focused field sets that field as the `{ origin }`, the [`:origin`](https://unpoly.com/api/origin.md) is now the focused field (instead of the `<form>` element)
  - When a form is watched or validated, the [`:origin`](https://unpoly.com/api/origin.md) is now the field that was changed (instead of the `<form>` element)
  - To select an active form with CSS, select `form.up-active, form:has(.up-active) { ... }`.
  - A form attribute that refers to the origin, like `[up-fail-target=":origin"]` (or the old `&`), now matches the button or field, not the form. Use `form:has(:origin)`, or remove the attribute when the form itself is the default target.
- Fix [`up.watch()`](https://unpoly.com/api/up.watch.md) (formerly [`up.observe()`](https://unpoly.com/api/up.observe.md)) crashing when passed an input outside a form.

## Network requests {#network-requests}

### Cache revalidation {#cache-revalidation}

In Unpoly 3, [cache](https://unpoly.com/learn/caching.md) entries are only considered _fresh_ for 15 seconds. When rendering older cache content, Unpoly automatically reloads the fragment to ensure that the user never sees expired content. This process is called [cache revalidation](https://unpoly.com/learn/caching.md#revalidation).

When re-visiting pages, Unpoly now often renders twice:

- An initial render pass from the cache (which may be expired)
- A second render pass from the server (which is always fresh)

This caching technique allows for longer cache times (90 minutes by default) while ensuring that users always see the latest content.

Servers may observe [conditional request headers](#conditional-requests) to skip the second render pass if the underlying data has not changed, making revalidation requests very inexpensive.

That said, the following changes were made:

- ❌ After rendering stale content from the cache, Unpoly now automatically renders a second time with fresh content from the server (_revalidation_).

  To disable cache revalidation, set `up.fragment.config.navigateOptions.revalidate = false`.

- The cache now distinguishes between _expiration_ (marking cache entries as stale) and _eviction_ (completely erasing cache entries).

- The old concept of _clearing_ has been replaced with _expiring_ the cache:
  - 🧩 The configuration `up.network.config.clearCache` has been renamed to [`up.network.config.expireCache`](https://unpoly.com/api/up.network.config.md#config.expireCache).

    It can be used to configure which requests should expire existing cache entries.

    By default Unpoly will expire the entire cache after a request with an [unsafe](https://developer.mozilla.org/en-US/docs/Glossary/Safe/HTTP) HTTP method.
  - 🧩 The configuration `up.network.config.cacheExpiry` has been renamed to [`up.network.config.cacheExpireAge`](https://unpoly.com/api/up.network.config.md#config.cacheExpireAge).
  - The default for [`up.network.config.cacheExpireAge`](https://unpoly.com/api/up.network.config.md#config.cacheExpireAge) is now 15 seconds (down from 5 minutes in Unpoly 2).

    ⚠️ If you have previously configured a custom value for `up.network.config.clearCache` (now `.expireCache`) to prevent the display of stale content, check if that configuration is still needed with [revalidation](https://unpoly.com/learn/caching.md#revalidation).
  - 🧩 The response header [`X-Up-Clear-Cache`](https://unpoly.com/api/X-Up-Clear-Cache.md) has been renamed to [`X-Up-Expire-Cache`](https://unpoly.com/api/X-Up-Expire-Cache.md).
  - 🧩 The option to keep a cache entry through `X-Up-Clear-Cache: false` has been removed.
  - 🧩 The function [`up.cache.clear(pattern)`](https://unpoly.com/api/up.cache.clear.md) has been renamed to [`up.cache.expire(pattern)`](https://unpoly.com/api/up.cache.expire.md).
  - 🧩 The attribute `[up-clear-cache]` has been renamed to `[up-expire-cache]`.
  - 🧩 The option [`up.render({ clearCache })`](https://unpoly.com/api/up.render.md) has been renamed to `{ expireCache }`.
  - 🧩 The option [`up.request({ clearCache })`](https://unpoly.com/api/up.request.md) has been renamed to `{ expireCache }`.

- Features have been added to evict cache entries:
  - New configuration [`up.network.config.evictCache`](https://unpoly.com/api/up.network.config.md#config.evictCache) lets you define which requests evict existing cache entries.
  - ⚠️ By default Unpoly will expire, but not evict any cache entries when a request is made.

    To restore Unpoly 2's behavior of evicting the entire cache after a request with an [unsafe](https://developer.mozilla.org/en-US/docs/Glossary/Safe/HTTP) HTTP method, configure the following:

    ```js
    up.network.config.evictCache = (request) => !request.isSafe()
    ```
  - New configuration [`up.network.config.cacheEvictAge`](https://unpoly.com/api/up.network.config.md#config.cacheEvictAge) (default is 90 minutes).
  - Added response header [`X-Up-Evict-Cache`](https://unpoly.com/api/X-Up-Evict-Cache.md).
  - Added function [`up.cache.evict(pattern)`](https://unpoly.com/api/up.cache.evict.md).

- Cache revalidation happens after [`up.render()`](https://unpoly.com/api/up.render.md) settles.

  To run code once all render passes have finished, pass an `{ onFinished }` callback or `await up.render(..).finished`.

- Cache revalidation can be controlled through a render option `{ revalidate }` or a link attribute `[up-revalidate]`.

  The default option value is `{ revalidate: 'auto' }`, which revalidates if [`up.fragment.config.autoRevalidate(response)`](https://unpoly.com/api/up.fragment.config.md#config.autoRevalidate) returns `true`. By default this configuration returns `true` if a response is older than [`up.network.config.cacheExpireAge`](https://unpoly.com/api/up.network.config.md#config.cacheExpireAge).

### Conditional requests {#conditional-requests}

- Unpoly now supports [conditional requests](https://unpoly.com/learn/conditional-requests.md). This allows your server to skip rendering and send an empty response if the underlying data has not changed.

  Common use cases for conditional requests are [polling](https://unpoly.com/api/up-poll.md) or [cache revalidation](https://unpoly.com/learn/caching.md#revalidation).

- Unpoly now remembers the standard [`Last-Modified`](https://unpoly.com/api/Last-Modified.md) and `E-Tag` headers a fragment was delivered with.

  Header values are set as [`[up-time]`](https://unpoly.com/api/up-time.md) and [`[up-etag]`](https://unpoly.com/api/up-etag.md) attributes on updated fragment. Users can also set these attributes manually in their views, to use different ETags for individually reloadable fragments.

- When a fragment is reloaded (or polled), these properties are sent as [`If-Modified-Since`](https://unpoly.com/api/If-Modified-Since.md) or [`If-None-Match`](https://unpoly.com/api/If-None-Match.md) request headers.

- Server can render nothing by sending status `304 Not Modified` or status `204 No Content`.

- Reloading is effectively free with conditional request support.

- 🧩 The header [`X-Up-Reload-From-Time`](https://unpoly.com/api/X-Up-Reload-From-Time.md) was deprecated in favor of the standard [`If-Modified-Since`](https://unpoly.com/api/If-Modified-Since.md).

### Handling connection loss {#handling-connection-loss}

Unpoly lets you handle many types of [connection problems](https://unpoly.com/learn/network-issues.md). The objective is to keep your application accessible as the user's connection becomes slow, [flaky](https://unpoly.com/learn/network-issues.md#flaky-connections) or [goes away entirely](https://unpoly.com/learn/network-issues.md#disconnects).

Unpoly 3 lets you handle [connection loss](https://unpoly.com/learn/network-issues.md#disconnects) with an `{ onOffline }` or `[up-on-offline]` callback:

```html
<a href="..." up-on-offline="if (confirm('You are offline. Retry?')) event.retry()">Post bid</a>
```

You may also configure a global handler by listening to [`up:fragment:offline`](https://unpoly.com/api/up:fragment:offline.md):

```js
up.on('up:fragment:offline', function(event) {
  if (confirm('You are offline. Retry?')) event.retry()
})
```

You may also do something other than retrying, like substituting content:

```js
up.on('up:fragment:offline', function(event) {
  up.render(event.renderOptions.target, { content: "You are offline." })
})
```

### Handling ["Lie-Fi"](https://www.urbandictionary.com/define.php?term=lie-fi) {#handling-lie-fi}

Often our device reports a connection, but we're _effectively offline_:

- Smartphone in EDGE cell
- Car drives into tunnel
- Overcrowded Wi-fi with massive packet loss

Unpoly 3 handles Lie-Fi with timeouts:

- ⚠️ All requests now have a default timeout of 90 seconds ([`up.network.config.timeout`](https://unpoly.com/api/up.network.config.md#config.timeout)).
- Timeouts will now trigger `onOffline()` and use your offline handling.
- Customize timeouts per-request by passing a `{ timeout }` option or setting an `[up-timeout]` attribute.

### Expired pages remain accessible while offline {#expired-pages-remain-accessible-while-offline}

With Unpoly 3, apps remain partially accessible when the user loses their connection:

- Cached content will remain navigatable for 90 minutes.
- Revalidation will fail, but not change the page and trigger `onOffline()`.
- Clicking uncached content will not change the page and trigger `onOffline()`.

While Unpoly 3 lets you handle disconnects, it's not full "offline" support:

- To fill up the cache the device must be online for the first part of the session (warm start)
- The cache is still in-memory and dies with the browser tab

For a comprehensive offline experience (cold start) we recommend a [service worker](https://web.dev/offline-fallback-page/) or a canned solution like [UpUp](https://www.talater.com/upup/) (no relation to Unpoly).

### More control about the progress bar {#more-control-about-the-progress-bar}

- You may now demote requests to the background by using `{ background: true }` or `[up-background]` when rendering or making a request

  Background requests are de-prioritized when the network connection is [saturated](https://unpoly.com/api/up.network.config.md#config.concurrency).

  Background requests don't trigger [`up:network:late`](https://unpoly.com/api/up:network:late.md) or show the progress bar.

- [Polling](https://unpoly.com/api/up-poll.md) requests are demoted to the background automatically.

- [Preload](https://unpoly.com/api/up-preload.md) requests are demoted to the background automatically.

- You may now set a custom response times over which a request is considered late by using `{ badResponseTime }` or `[up-bad-response-time]` when rendering or making a request

  This allows you to delay the [`up:network:late`](https://unpoly.com/api/up:network:late.md) event or show the progress bar later or earlier.

  The default `up.network.config.badResponseTime` can now also be a `Function(up.Request): number` instead of a constant number value.

### Caching of optimizing responses {#caching-of-optimizing-responses}

Unpoly has always allowed server-side code to inspect [request headers](https://unpoly.com/api/up.protocol.md) to [customize or shorten responses](https://unpoly.com/learn/optimizing-responses.md), e.g. by omitting content that isn't [targeted](https://unpoly.com/learn/targeting-fragments.md). Unpoly makes some changes how optimized responses are [cached](https://unpoly.com/learn/caching.md):

- ⚠️ Requests with the same URL and HTTP method, but different header values (e.g. [`X-Up-Target`](https://unpoly.com/api/X-Up-Target.md)) now share the same cache entry.

- ⚠️ If a server optimizes its response, all request headers that influenced the response should be listed in a [`Vary`](https://unpoly.com/api/Vary.md) response header.

  A [`Vary`](https://unpoly.com/api/Vary.md) header tells Unpoly to partition its [cache](https://unpoly.com/learn/caching.md) for that URL so that each request header value gets a separate cache entries.

  You can set a [`Vary`](https://unpoly.com/api/Vary.md) header manually from your server-side code. You may also be using a library like [unpoly-rails](https://github.com/unpoly/unpoly-rails) that sets the [`Vary`](https://unpoly.com/api/Vary.md) header automatically.

- Sending [`Vary`](https://unpoly.com/api/Vary.md) headers also prevents browsers from using an optimized response for full page loads.

- 🧩 The configuration `up.network.config.requestMetaKeys` has been removed.

### Support for Unicode characters in HTTP headers {#support-for-unicode-characters-in-http-headers}

- When Unpoly writes JSON into HTTP request headers, high ASCII characters are now escaped. This is due to a limitation in HTTP where only 7-bit characters can be transported safely through headers.
- 🧩 The header [`X-Up-Title`](https://unpoly.com/api/X-Up-Title.md) is now a JSON-encoded string, surrounded by JSON quotes.

### Detecting failure when the server sends wrong HTTP status {#detecting-failure-when-the-server-sends-wrong-http-status}

Unpoly requires servers to send an HTTP error code to signal failure. E.g. an invalid form should render with HTTP 422 (Unprocessable Entity).

However, Misconfigured server endpoints may send HTTP 200 (OK) for everything. This is not always easy to fix, e.g. when screens are rendered by libraries outside your control. Unpoly 3 addresses this with the following changes:

- Listeners to [`up:fragment:loaded`](https://unpoly.com/api/up:fragment:loaded.md) can now can force failure by setting `event.renderOptions.fail = true`.
- You may use [`up.network.config.fail`](https://unpoly.com/api/up.network.config.md#config.fail) to configure a global rule for when a response is considered to have failed.

### Various changes {#various-changes-4}

- You may now pass [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) values to all functions that also accept an [`up.Params`](https://unpoly.com/api/up.Params.md) object.

- When a request is scheduled and aborted within the same microtask, it no longer touches the network.

- [`up.network.config.concurrency`](https://unpoly.com/api/up.network.config.md#config.concurrency) now defaults to 6 (3 while reducing requests)

- ⚠️ When calling [`up.request()`](https://unpoly.com/api/up.request.md) manually, the request is now only associated with the current layer if either `{ origin, layer, target }` option was passed.

  If neither of these options are given, the request will send no headers like [`X-Up-Target`](https://unpoly.com/api/X-Up-Target.md) or [`X-Up-Mode`](https://unpoly.com/api/X-Up-Mode.md). Also, since the request is no longer associated with the layer, it will not be aborted if the layer closes.

- 🧩 The [`up.network.isIdle()`](https://unpoly.com/api/up.network.isIdle.md) function has been deprecated. Use `!up.network.isBusy()` instead.

- 🧩 The event `up:request:fatal` was renamed to [`up:request:offline`](https://unpoly.com/api/up:request:offline.md).

- 🧩 The events `up:request:late` and `up:request:recover` were renamed to [`up:network:late`](https://unpoly.com/api/up:network:late.md) and [`up:network:recover`](https://unpoly.com/api/up:network:recover.md) respectively. We may eventually re-introduce `up:request:late` and `up:request:recover` to support tracking individual requests (but not now).

- New method [`up.Request#header()`](https://unpoly.com/api/up.Request.prototype.header.md) to access a given header.

- 🧩 The method [`up.Response#getHeader()`](https://unpoly.com/api/up.Response.prototype.getHeader.md) was renamed to [`up.Response#header()`](https://unpoly.com/api/up.Response.prototype.header.md). It is now stable.

- The property `up.Response.prototype.request` is now internal API and should no longer be used.

- 🧩 Disabling the cache with `up.network.config.cacheSize = 0` is no longer supported. To disable automatic caching during navigation, set `up.fragment.config.navigateOptions.cache = false` instead.

## Utility functions {#utility-functions}

### Support for [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) objects {#support-for-iterable-objects}

- [`up.util.map()`](https://unpoly.com/api/up.util.map.md) now accepts any iterable object.
- [`up.util.each()`](https://unpoly.com/api/up.util.each.md) now accepts any iterable object.
- [`up.util.filter()`](https://unpoly.com/api/up.util.filter.md) now accepts any iterable object.
- [`up.util.every()`](https://unpoly.com/api/up.util.every.md) now accepts any iterable object.
- [`up.util.findResult()`](https://unpoly.com/api/up.util.findResult.md) now accepts any iterable object.
- [`up.util.flatMap()`](https://unpoly.com/api/up.util.flatMap.md) now accepts any iterable object.

### Deprecated functions in favor of native browser API {#deprecated-functions-in-favor-of-native-browser-api}

- 🧩 Deprecated [`up.util.assign()`](https://unpoly.com/api/up.util.assign.md). Use `Object.assign()` instead.
- 🧩 Deprecated [`up.util.values()`](https://unpoly.com/api/up.util.values.md). Use `Object.values()` instead.

## DOM helpers {#dom-helpers}

### Deprecated functions in favor of native browser API {#deprecated-functions-in-favor-of-native-browser-api-1}

- 🧩 Deprecated [`up.element.remove()`](https://unpoly.com/api/up.element.remove.md). Use `Element#remove()` instead.
- 🧩 Deprecated [`up.element.matches()`](https://unpoly.com/api/up.element.matches.md). Use `Element#matches()` instead.
- 🧩 Deprecated [`up.element.closest()`](https://unpoly.com/api/up.element.closest.md). Use `Element#closest()` instead.
- 🧩 Deprecated [`up.element.replace()`](https://unpoly.com/api/up.element.replace.md). Use `Element#replaceWith()` instead.
- 🧩 Deprecated [`up.element.all()`](https://unpoly.com/api/up.element.all.md). Use `document.querySelectorAll()` or `Element#querySelectorAll()` instead.
- 🧩 Deprecated [`up.element.toggleClass()`](https://unpoly.com/api/up.element.toggleClass.md). Use `Element#classList.toggle()` instead.
- 🧩 Deprecated [`up.element.isDetached()`](https://unpoly.com/api/up.element.isDetached.md). Use `!Element#isConnected` instead.

### Various changes {#various-changes-5}

- ⚠️ [`up.element.booleanAttr()`](https://unpoly.com/api/up.element.booleanAttr.md) now returns `true` for an attribute value that is present but non-boolean.

  For example, the attribute value `[up-instant='up-instant']` is now considered `true`.

  Previously it returned `undefined`.

## Animation {#animation}

- ⚠️ [Custom animation](https://unpoly.com/api/up.animation.md) and [transition](https://unpoly.com/api/up.transition.md) functions must now settle synchronously when observing [`up:motion:finish`](https://unpoly.com/api/up:motion:finish.md).

## Reworked documentation {#reworked-documentation}

In our ongoing efforts to evolve Unpoly's documentation from an API reference to a guide, we have added several documentation pages:

- [Targeting fragments](https://unpoly.com/learn/targeting-fragments.md)
- [Target derivation](https://unpoly.com/learn/target-derivation.md)
- [Skipping unnecessary rendering](https://unpoly.com/learn/conditional-requests.md)
- [Render hooks](https://unpoly.com/learn/render-lifecycle.md)
- [Aborting requests](https://unpoly.com/learn/aborting-requests.md)
- [Handling failed responses](https://unpoly.com/learn/error-responses.md)
- [Attaching data to elements](https://unpoly.com/learn/data.md)
- [Optimizing responses](https://unpoly.com/learn/optimizing-responses.md)
- [Controlling focus](https://unpoly.com/learn/focus.md)
- [Validating forms](https://unpoly.com/learn/validation.md)
- [Disabling forms while working](https://unpoly.com/learn/disabling-forms.md)
- [Reactive server forms](https://unpoly.com/learn/reactive-server-forms.md)
- [Watch options](https://unpoly.com/learn/watch-options.md)
- [Caching](https://unpoly.com/learn/caching.md)
- [Handling network issues](https://unpoly.com/learn/network-issues.md)
- [Conditional requests](https://unpoly.com/learn/conditional-requests.md)
- [Progress bar](https://unpoly.com/learn/progress-bar.md)
- [Tracking page views](https://unpoly.com/learn/tracking-page-views.md)
- [Updating history](https://unpoly.com/learn/updating-history.md)
- [Restoring history](https://unpoly.com/learn/restoring-history.md)
- [Predefined animations](https://unpoly.com/learn/animations.md#available-animations)
- [Predefined transitions](https://unpoly.com/learn/transitions.md#available-transitions)

All existing documentation pages from Unpoly 2 remain available:

- [Handling all links and forms](https://unpoly.com/learn/handling-all-links.md)
- [Tuning the scroll behavior](https://unpoly.com/learn/scroll-tuning.md)
- [Migrating legacy JavaScripts](https://unpoly.com/learn/legacy-scripts.md)
- [Scrolling](https://unpoly.com/learn/scrolling.md)
- [Navigation](https://unpoly.com/learn/navigation-defaults.md)
- [Layer terminology](https://unpoly.com/learn/overlays.md#layer-modes)
- [Layer option](https://unpoly.com/learn/targeting-other-layers.md)
- [Opening overlays](https://unpoly.com/learn/opening-overlays.md)
- [Subinteractions](https://unpoly.com/learn/subinteractions.md)
- [Closing overlays](https://unpoly.com/learn/closing-overlays.md)
- [Customizing overlays](https://unpoly.com/learn/customizing-overlays.md)
- [Layer context](https://unpoly.com/learn/layer-context.md)
- [Motion tuning](https://unpoly.com/learn/controlling-motion.md#duration-and-easing)
- [URL patterns](https://unpoly.com/api/url-patterns.md)
- Working with strict Content Security Policies

## Migration polyfills {#migration-polyfills}

- New polyfills for almost all functionality that was deprecated in this version 3.0.0.

- When [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading.md) migrates a renamed attribute, the old attribute is now removed.

- Fix a up where `unpoly-migrate.js` would not rewrite the deprecated `{ reveal }` option when navigating.

- ⚠️ The legacy option [`up.render({ data })`](https://unpoly.com/api/up.render.md) and [`up.request({ data })`](https://unpoly.com/api/up.request.md) is no longer renamed to `{ params }` (renamed in Unpoly 0.57).

  Unpoly now uses the `{ data }` option to [preserve element data through reloads](https://unpoly.com/learn/data.md#preserving).

## Framework {#framework}

- A new experimental event [`up:framework:booted`](https://unpoly.com/api/up:framework:booted.md) is emitted when the framework has booted and the initial page has been compiled.

- All errors thrown by Unpoly now inherit from `up.Error`.

  This makes it easier to detect the type of exception in a `catch()` clause:

  ```js
  try {
    await up.render('main', { url: '/foo' })
  } catch (exception) {
    if (exception instanceof up.Error) {
      // handle Unpoly exception
    } else {
      // re-throw unhandled exception
      throw exception
    }
  }
  ```

## Dropped support for legacy technologies {#dropped-support-for-legacy-technologies}

### Dropped support for IE11 and legacy Edge {#dropped-support-for-ie11-and-legacy-edge}

⚠️ Unpoly 3 drops support for Internet Explorer 11 and [legacy Edge (EdgeHTML)](https://en.wikipedia.org/wiki/EdgeHTML).

Unlike other breaking changes, support cannot be restored through [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading.md). If you need to support IE11, use [Unpoly 2](https://v2.unpoly.com).

The new compatibility targets for Unpoly 3 are major [evergreen](https://stephenweiss.dev/evergreen-browsers) browsers (Chrome, Firefox, Edge) as well as last two major versions of Safari / Mobile Safari.

### ES5 build has been replaced with an ES6 build {#es5-build-has-been-replaced-with-an-es6-build}

⚠️ Unpoly no longer ships with an version transpiled down to ES5 (`unpoly.es5.js`). Instead there is now a ES6 version (`unpoly.es6.js`).

Since most modern browsers now have great JavaScript support, we encourage you to try out the untranspiled distribution (`unpoly.js`), which has the smallest file size.

### jQuery helpers are deprecated {#jquery-helpers-are-deprecated}

jQuery helper functions have been moved to [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading.md):

- 🧩 The function [`up.$compiler()`](https://unpoly.com/api/up.$compiler.md) was deprecated.
- 🧩 The function [`up.$macro()`](https://unpoly.com/api/up.$macro.md) was deprecated.
- 🧩 The function [`up.$on()`](https://unpoly.com/api/up.$on.md) was deprecated.

### Unpoly 2 maintenance is ending {#unpoly-2-maintenance-is-ending}

- With the release of Unpoly we're ending maintenance of Unpoly 2. Expect little to no changes to Unpoly 2 in the future.
- GitHub issues that have been fixed in Unpoly 3 will be closed.
- The legacy documentation for Unpoly 2.x has been archived to [v2.unpoly.com](https://v2.unpoly.com).
- The code for Unpoly 2 can be found in the [`2.x-stable`](https://github.com/unpoly/unpoly/tree/2.x-stable) branch.

## Upgrading {#upgrading}

If you're upgrading from an older Unpoly version you should load [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading.md) to polyfill deprecated APIs. Changes handled by `unpoly-migrate.js` are not considered breaking changes.

See our [upgrading guide](https://unpoly.com/changes/upgrading.md) for details.

