The work-in-progress package up.radio
will contain functionality to
passively receive updates from the server. Currently the following functionality is implemented:
Elements with an [up-hungry]
attribute are updated whenever there is a matching element found in a successful response. The element is replaced even when it isn't targeted directly.
Use cases for this are unread message counters or notification flashes. Such elements often live in the layout, outside of the content area that is being replaced.
When a reserver response contains a <meta name="csrf-param">
or <meta name="csrf-token">
element, it is automatically updated in the current page.
[aria-label]
attributes are used if no better attributes exist (like [id]
or [up-id]
attributes).[name]
attribute is used, the tag name is also used. E.g. meta[name="csrf-token"]
.[id="foo/bar"]
.[up-fail-reveal]
attribute to indicate which element should be revealed when the server responds with an error. You may use this, for example, to reveal the first validation error message:
<form up-target=".content" up-fail-reveal=".error">
...
</form>
[up-reveal]
attribute will now only honor the attribute when the form submission was successful.[up-restore-scroll]
attribute will now only honor the attribute when the form submission was successful.[up-reveal="css-selector"]
attribute will no longer crash when the selector could not be found.[up-fail-reveal]
attribute to indicate which element should be revealed when the server responds with an error[up-reveal]
attribute will now only honor the attribute when the link could be followed successfully.[up-restore-scroll]
attribute will now only honor the attribute when the link could be followed successfully.[up-reveal="css-selector"]
attribute will no longer crash when the selector could not be found.
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.