---
area: "Changes"
parent: "Changes"
url: "https://unpoly.com/changes/3.12.0"
released: "2025-09-24"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [Changes](https://unpoly.com/changes.md)</nav>

# Version 3.12.0

Released on September 24, 2025 with [72 commits](https://github.com/unpoly/unpoly/commits/v3.12.0)

This release adds [asynchronous compilers](https://unpoly.com/api/up.compiler.md#async) and many other features requested by the community.
We also fixed a number of [performance regressions](#performance-fixes) introduced by Unpoly [3.11](https://unpoly.com/changes/3.11.0.md).

Changes that may need your attention are marked with 🧩 when [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading.md) 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.

> Note
>
> Our sponsor [makandra](https://makandra.de/en) funded this release ❤️
> Please consider hiring makandra for [Unpoly support](https://unpoly.com/support.md).

<nav aria-label="Contents">

- [Asynchronous compilers](#asynchronous-compilers)
- [Performance fixes](#performance-fixes)
- [HTML content-type required](#html-content-type-required)
- [New guides](#new-guides)
- [Submit buttons can override form attributes](#submit-buttons-can-override-form-attributes)
- [Sticky layout elements](#sticky-layout-elements)
- [Support partial tables responses](#support-partial-tables-responses)
- [Expanding click areas](#expanding-click-areas)
- [Preserving fragments](#preserving-fragments)
- [Closing overlays](#closing-overlays)
- [Manual booting](#manual-booting)
- [Fragment API](#fragment-api)
- [Smaller fixes and changes](#smaller-fixes-and-changes)
- [Upgrading](#upgrading)

</nav>

## Asynchronous compilers {#asynchronous-compilers}

Compiler functions can now be [`async`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). This is useful when a compiler needs to fetch network resources, or when calling a library with an asynchronous API:

```js
up.compiler('textarea.wysiwyg', async function(textarea) {
  let editor = await import('wysiwyg-editor')
  editor.init(textarea)
})
```

You can also use this to split up expensive tasks, giving the browser a chance to render and process user input:

```js
up.compiler('.element', async function(element) {
  doRenderBlockingWork(element)
  await scheduler.yield()
  doUserVisibleWork(element)
})
```

### Cleaning up async work {#async-destructors}

Like synchronous compilers, async compiler functions can return a [destructor function](https://unpoly.com/api/up.compiler.md#destructor):

```js
up.compiler('textarea.wysiwyg', async function(textarea) {
  let editor = await import('wysiwyg-editor')
  editor.init(textarea)
  return () => editor.destroy(textarea)
})
```

Unpoly guarantees that the destructor is called, even if the element gets destroyed before the compiler function terminates.

### Timing render-blocking mutations {#async-timing}

Unpoly will run the first [task](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/) of every compiler function before allowing the browser to render DOM changes. If an async compiler function runs for multiple tasks, the browser will render between tasks. If you have render-blocking mutations that should be hidden from the user, these must happen in the first task.

![Timing of compiler tasks and browser render frames](https://unpoly.com/images/api/compiler-tasks.svg)

Async compilers will not delay the promise returned by rendering functions [`up.render()`](https://unpoly.com/api/up.render.md) or [`up.layer.open()`](https://unpoly.com/api/up.layer.open.md).
Async compilers _will_ delay the promise returned by [`up.render().finished`](https://unpoly.com/learn/render-lifecycle.md#postprocessing) and [`up.hello()`](https://unpoly.com/api/up.hello.md).

### `up.hello()` is now async {#uphello-is-now-async}

⚠️ The [`up.hello()`](https://unpoly.com/api/up.hello.md) function now returns a promise that fulfills when all synchronous and asynchronous compilers have terminated:

```js
let textarea = up.element.createFromHTML('<textarea class="wysiwyg"></textarea>')
await up.hello(textarea)
// WYSIWYG editor is now initialized
```

The fulfillment value is the same element that was passed as an argument:

```js
let html = '<textarea class="wysiwyg"></textarea>'
let textarea = await up.hello(up.element.createFromHTML(html))
```

## Performance fixes {#performance-fixes}

Unpoly 3.11 introduced a number of performance regressions that would be very noticeable on pages with many elements, or many forms. To address this, this release includes a number of performance fixes:

- Fix a performance regression where Unpoly would track the DOM for dynamically inserted [`[up-validate]`](https://unpoly.com/api/up-validate.md) fields for every form. Now fields are only tracked for forms that use [`[up-validate]`](https://unpoly.com/api/up-validate.md).
- Features that need to track the insertion or removal of elements now only sync with the DOM once after a render pass.
- Watching a single field no longer tracks dynamically inserted fields.
- Improved the performance of internal form lookups.

## HTML content-type required {#html-content-type-required}

⚠️ Unpoly now requires server responses with an HTML content-type, like `text/html` or `application/xhtml+xml`. Trying to render responses with a different type will throw an error, even if the response body contains HTML markup.

Restricting content types is a security precaution. It protects in a hypothetical scenario where an attacker can both upload a file _and_ can use an existing XSS vulnerability to cause Unpoly to render that file. It doesn't affect applications that reliably escape user input.

You can configure which responses Unpoly will process by configuring a function in [`up.fragment.config.renderableResponse`](https://unpoly.com/api/up.fragment.config.md#config.renderableResponse). To render _any_ response regardless of content-type, configure a function that always returns `true`:

```js
up.fragment.config.renderableResponse = (response) => true
```

## New guides {#new-guides}

The [documentation](https://unpoly.com/api.md) has been extended with new guides:

- [Enhancing elements with JavaScript](https://unpoly.com/learn/enhancing-elements.md) teaches everything you need to know about compilers, destructors and preventing memory leaks.
- [Submitting forms in-place](https://unpoly.com/learn/submitting-forms.md) shows how to have Unpoly handle forms from HTML or JavaScript.
- [Notification flashes](https://unpoly.com/learn/flashes.md) now contains guidance for [suppressing flashes in cached responses](https://unpoly.com/learn/flashes.md#caching).

## Submit buttons can override form attributes {#submit-buttons-can-override-form-attributes}

Submit buttons can now supplement or override most Unpoly attributes from the form:

```html
<form method="post" action="/proposal/accept" up-submit>
  <button type="submit" up-target="#success">Accept</button>
  <button type="submit" up-target="#failure" up-confirm="Really reject?">Reject</button>
</form>
```

Individual submit buttons can now opt for a full page load, by setting an `[up-submit="false"]` attribute:

```html
<form method="post" action="/report/update" up-submit>
  <button type="submit" name="command" value="save">Save report</button>
  <button type="submit" name="command" value="download" up-submit="false">Download PDF</button>
</form>
```

See [`[up-submit]`](https://unpoly.com/api/up-submit.md#attributes) for a list of overridable attributes

## Sticky layout elements {#sticky-layout-elements}

When scrolling to reveal a target element, Unpoly will ensure that layout elements with [`[up-fixed=top]`](https://unpoly.com/api/up-fixed-top.md) are not covering the revealed content.

You can now use `[up-fixed]` on elements with [`position: sticky`](https://www.w3schools.com/howto/howto_css_sticky_element.asp). Unpoly will measure sticky element like permanently fixed elements. The current scroll position is not taken into account.

## Support partial tables responses {#support-partial-tables-responses}

In the past Unpoly didn't allow a server to [optimize its response](https://unpoly.com/learn/optimizing-responses.md) when the result was a single table row (or cell) without an enclosing `<table>`:

```http
Content-type: text/html

<tr>
  <td>...</td>
</tr>
```

Unpoly can now parse responses that only contain a `<tr>`, `<td>` or `<th>` element, without an enclosing `<table>` (issue [#91](https://github.com/unpoly/unpoly/issues/91)).

## Expanding click areas {#expanding-click-areas}

Unpoly lets you enlarge a link's click area using the [`[up-expand]`](https://unpoly.com/api/up-expand.md) attribute. This version addresses inconsistent (or impractical) assignment of the [`.up-active`](https://unpoly.com/api/up-active.md) [feedback class](https://unpoly.com/learn/feedback-classes.md) when an expanded link is clicked.

When either the [`[up-expand]`](https://unpoly.com/api/up-expand.md) container or the first link is clicked, the [`.up-active`](https://unpoly.com/api/up-active.md) class is now assigned to both elements:

```html
<div up-expand class="up-active">
  <a href="/foo" class="up-active">Foo</a>
  <a href="/bar">Bar</a>
</div>
```

When a non-expanded link is clicked, now only that link becomes [`.up-active`](https://unpoly.com/api/up-active.md):

```html
<div up-expand>
  <a href="/foo">Foo</a> <!-- not active -->
  <a href="/bar" class="up-active">Bar</a>
</div>
```

## Preserving fragments {#preserving-fragments}

Two changes were made to [preserving elements](https://unpoly.com/learn/keeping-elements.md) using the [`[up-keep]`](https://unpoly.com/api/up-keep.md) attribute:

- Added an experimental event [`up:fragment:kept`](https://unpoly.com/api/up:fragment:kept.md). This event is emitted after all [keep conditions](https://unpoly.com/learn/keeping-elements.md#conditions) are evaluated and preservation can no longer be prevented. A listener can be sure that the element is going to be kept.
- Fragments with both [`[up-poll]`](https://unpoly.com/api/up-poll.md) and [`[up-keep]`](https://unpoly.com/api/up-keep.md) now continue polling when the element is kept (fixes [#763](https://github.com/unpoly/unpoly/issues/763))

## Closing overlays {#closing-overlays}

- When an overlay is [closed](https://unpoly.com/learn/closing-overlays.md), the overlay now remains in the [layer stack](https://unpoly.com/api/up.layer.stack.md) until all destructors have run. This way destructor functions can still look up elements in their layer.
- 🧩 The method [`up.Layer#isOpen()`](https://unpoly.com/api/up.Layer.prototype.isOpen.md) has been deprecated. Use `up.Layer#isAlive() instead`.
- 🧩 The method [`up.Layer#isClosed()`](https://unpoly.com/api/up.Layer.prototype.isClosed.md) has been deprecated. Use `!up.Layer#isAlive() instead`.
- ⚠️ When [closing an overlay](https://unpoly.com/learn/closing-overlays.md) that is already closed, Unpoly now throws an `AbortError` instead of doing nothing.
- Fix a crash when an [`[up-switch]`](https://unpoly.com/api/up-switch.md) input without a containing form is placed in an overlay, and that overlay is closed.

## Manual booting {#manual-booting}

- ⚠️ To boot manually, the [`[up-boot=manual]`](https://unpoly.com/api/up-boot-manual.md) must now be set on the `<html>` element instead of on the `<script>` loading Unpoly.
- Unpoly now supports [manual booting](https://unpoly.com/api/up-boot-manual.md) when Unpoly is loaded as a `<script type="module">`.

## Fragment API {#fragment-api}

- The [`up.fragment.get()`](https://unpoly.com/api/up.fragment.get.md) function now has a `{ destroying: true }` option. This allows to find destroyed elements that are still playing out their exit animation. Note that all [`up.fragment`](https://unpoly.com/api/up.fragment.md) functions normally ignore elements in an exit animation.
- Added an experimental function [`up.fragment.isAlive()`](https://unpoly.com/api/up.fragment.isAlive.md). It returns whether an element is both attached to the DOM and also not in an exit animation.

## Smaller fixes and changes {#smaller-fixes-and-changes}

- Reverted the implementation of [`up.util.task()`](https://unpoly.com/api/up.util.task.md) to again queue macrotasks using `setTimeout()` instead of `postMessage()`. Unpoly 3.11 only recently switched to `postMessage()` because of its tighter scheduling. Unfortunately message order is erratic with `postMessage()` in Safari, making it hard to reason about the sequence of asynchronous callbacks.
- Fix a bug where Unpoly would no longer restore history entries after the page is reloaded (issue [#773](https://github.com/unpoly/unpoly/issues/773)).
- Added an experimental method [`up.Response#isHTML()`](https://unpoly.com/api/up.Response.prototype.isHTML.md). It returns whether the response has a [content-type](https://unpoly.com/api/up.Response.prototype.contentType.md) of `text/html` or `application/xml+html`. It doesn't test if the response body actual contains a valid HTML document.
- Fix a crash when [`up.render({ response })`](https://unpoly.com/api/up.render.md) is called while another request is in flight.
- When rendering, and request with the same [`{ failTarget }`](https://unpoly.com/learn/error-responses.md#fail-options) was made while waiting for the network, and the first request responded with an error status and updates , the second request is now aborted.

## 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.

