Version 0.33.0
Released on with 26 commits
Compatible changes
-
When a fragment updates cannot find the requested element, you can now define a fallback selector to use instead.
A
{ fallback }option has been added to all JavaScript functions that update fragments, likeup.replace().Also an
[up-fallback]attribute has been added to all CSS selectors that update fragments, like for[up-follow].You can also define fallbacks globally using the
up.dom.configproperty. -
Unpoly no longer crashes when a request fails due to a timeout or network problem. In such cases, async functions (like
up.replace()) will leave the page unchanged and reject the returned promise. -
Functions that make a request (like
up.replace()or likeup.ajax()) now accept a new option{ timeout }. -
Modals no longer create an
.up-modalelement when the server returns a non-200 status and the{ failTarget }is replaced instead -
Popups no longer create an
.up-popupelement when the server returns a non-200 status and the{ failTarget }is replaced instead -
Improve performance when updating fragments without transitions
-
When updating the
<body>element with a transition, that transition is now silently ignored instead of throwing an error. -
up.util.resolvedPromise()now accepts arguments which will become the resolution values. -
up.util.resolvedDeferred()now accepts arguments which will become the resolution values. -
New utility method
up.util.rejectedPromise(). -
up.first()has new option{ origin }. You can use it provide a second element or selector that can be referenced as&in the first selector:$input = $('input.email'); up.first('.field:has(&)', $input); // returns the .field containing $input -
Fix a bug where the document title wasn't restored when the user uses the back button
-
When revealing a page fragment, Unpoly will include the element's top and bottom margin in the area that should be revealed.
Breaking changes
- ⚠️
up.replace()now returns a rejected promise if the server returns a non-200 status code. - ⚠️
up.util.merge()has been replaced withup.util.assign(), which no longer makes exceptions fornullandundefinedproperty values. This behaves likeObject.assign. - 🧩 The
up.flowmodule has been renamed toup.dom. - 🧩 The
up.navigationmodule has been renamed toup.status. - ⚠️ Functions that measure position, dimensions or margin now return floats instead of rounded integers.