Changelog ========= Changes to this project will be documented in this file. This project mostly adheres to [Semantic Versioning](http://semver.org/). 0.50.2 ------ ### Fragment updates - Updating fragments is now much faster when no [`[up-keep]`](/up-keep) elements are involved. ### Scrolling - [`up.reveal()`](/up.reveal) no longer crashes when called with a CSS selector or non-jQuery element. - [`up.reveal()`](/up.reveal) now returns a rejected promise when no viewport could be found for the given element. ### Links - [`[up-expand]`](/up-expand) now ignores clicks on [form fields](/up.form.config#config.fields). This is useful e.g. when `up-expand`ing a table row that contains both links and form fields. ### Network - [`a[up-preload]`](/a-up-preload) will no longer preload a link when the user holds the Shift, Ctrl or Meta key while hovering. 0.50.1 ------ ### General - Boolean HTML attributes are now also considered `true` if their values equal the attribute name, e.g. `up-keep="up-keep"` ([#36](https://github.com/unpoly/unpoly/issues/36)) ### AJAX - [`up.request()`](/up.request) now sends an `X-Requested-With: XMLHttpRequest` headers. This header is used by many server-side frameworks to detect an AJAX request. ([#42](https://github.com/unpoly/unpoly/issues/42)) 0.50.0 ------ This is a major update with some breaking changes. Expect a few more updates like this as we move closer to our 1.0 release in 2018. ### General - jQuery 3 is now supported in addition to jQuery 1.9+ and jQuery 2. - Unpoly now uses [native Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) instead of jQuery deferreds. - You can now help improve Unpoly's documentation by clicking an *Edit this page* link on any [unpoly.com](https://unpoly.com/) subpage (like [`a[up-target]`](/a-up-target)). ### Browser support - To enable support for Internet Explorer 11 you need to install a Polyfill for `Promise`. We recommend [ES6-promise](https://github.com/stefanpenner/es6-promise) (2.4 KB gzipped). - Fix a bug where Unpoly would not boot on Safari 9 and 10 if the initial page was loaded with a `POST` method. ### AJAX - Unpoly now uses [native XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) instead of `jQuery.ajax()`. If you have been hacking into Unpoly's networking through `jQuery.ajaxPrefilter()`, you must now use the [`up:proxy:load`](/up:proxy:load) event. - [`up.ajax()`](/up.ajax) has been deprecated since its signature is incompatible with native promises. Please use [`up.request()`](/up.request) instead, whose promise fulfills with an [`up.Response`](/up.Response) object. - The `up:proxy:received` event has been renamed to [`up:proxy:loaded`](/up:proxy:loaded). - The [`up:proxy:load`](/up:proxy:load) event properties have changed. You can now access request properties through a key `{ request }`, e.g. `event.request.url`. - The [`up:proxy:load`](/up:proxy:load) event can now be prevented to prevent a request from being sent to the network. - The [`up:proxy:load`](/up:proxy:load) event now allows listeners to change request headers by manipulating the `event.request.headers` object. - A new event [`up:proxy:fatal`](/up:proxy:fatal) will be [emitted](/up.emit) when an [AJAX request](/up.request) encounters fatal error like a timeout or loss of network connectivity. ### Links - Links with unsafe HTTP methods like `POST` are no longer marked as [`.up-current`](/a.up-current), even if their `[href]` matches the current URL. - New experimental function [`up.link.isSafe()`](/up.link.isSafe). It returns whether the given link has a [safe](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.1) HTTP method like `GET`. ### Fragment updates - When a selector was not found in the response, the error notification now offers a link to show the unexpected response. - The event [`up:fragment:destroy`](/up:fragment:destroy) can no longer be prevented. ### History - Clicking a link with an [`[up-restore-scroll]`](/a-up-target#up-restore-scroll) attribute will no longer crash if no previous scroll position for given URL is known ([#25](https://github.com/unpoly/unpoly/issues/25)) - Fix a bug where going back in history would sometimes not call destructors ([#24](https://github.com/unpoly/unpoly/issues/24)) ### Forms - [`up.observe()`](/up.observe) no longer sends multiple callbacks when a previous callback was slow to respond. ### Tooltips - Fix a bug where tooltips would sometimes stay open when many tooltips are opened and closed concurrently. ### Server protocol - When the server [signals a redirect with a `X-Up-Location` header](/up.protocol#redirect-detection), sending a `X-Up-Method` header is now optional. If it is missing, `GET` is assumed. - Unpoly will often update a different selector in case the request fails. This second selector is now sent to the server as a `X-Up-Fail-Target` header. - You can now [configure how CSRF tokens are sent your server-side framework](/up.protocol.config). - CSRF tokens are no longer sent for cross-domain requests. ### Animation - `up.motion.none()` has been removed without replacement. Just pass `false` or the string `'none'` to indicate a animation or transition which has no visual effects and completes instantly. - [`up.motion.finish()`](/up.motion.finish) is now async. It returns a promise that fulfills when all animations are finished. - [`up.motion.finish()`](/up.motion.finish) now also finishes animations in ancestors of the given element. ### Modals - [`up.follow()`](/up.follow) will now open a modal if the given link has an [`[up-modal]`](/a-up-modal) attribute - [`a[up-modal]`](/a-up-modal) links can now have an `[up-fail-target]` attribute to indicate which selector to replace for an non-200 response - Fix a bug where preloading an up-modal link would create an invisible .up-modal container in the DOM. ### Popups - [`up.follow()`](/up.follow) will now open a popup if the given link has [`[up-popup]`](/a-up-popup) attribute - up-popup links can now have an up-fail-target attribute to indicate which selector to replace for an non-200 response - Fix a bug where preloading an up-popup link would create an invisible .up-popup container in the DOM. - [`up.popup.attach()`](/up.popup.attach) now throws an error if neither `{ url }` nor `{ html }` options are given. ### Events - When async functions emit an event and that event is prevented, the async function now rejects with an [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error). - When async functions are called wth `{ confirm: true }` and the user denies confirmation, the async function now rejects with an [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error). ### Utility functions - [`up.util.setTimer()`](/up.util.setTimer) is now always async, even when called with a delay of `0` (zero). The function is now stable. - `up.util.isHash()` has been removed without replacement. In your code you can replace `up.util.isHash(x)` with `up.util.isObject(x) && !up.util.isFunction(x)`. - `up.util.resolvedDeferred()` has been removed without replacement. Use `Promise.resolve()` instead. - `up.util.resolvedPromise()` has been removed without replacement. Use `Promise.resolve(`) instead. - `up.util.rejectedPromise()` has been removed without replacement. Use `Promise.reject()` instead. - `up.util.unresolvableDeferred()` has been removed without replacement. Use `new Promise(function() {})` instead. - `up.motion.when()` has been removed without replacement. Use `Promise.all()` instead. - [`up.util.isString()`](/up.util.isString) now also returns true for `String` instances (in addition to string literals) - [`up.util.isNumber()`](/up.util.isNumber()) now also returns true for `Number` instances (in addition to number literals) ### Ruby on Rails bindings - New method `up.fail_target` available in controllers, helpers and views. It returns the selector targeted for a failed response. - New method `up.fail_target?(target)` available in controllers, helpers and views. It returns whether the given selector is targeted for a failed response. - New method `up.any_target?(target)` available in controllers, helpers and views. It returns whether the given selector is targeted for a either a successful or failed response. 0.37.0 ------ ### Compatible changes - Fix a bug where [replacing](/up.replace) the `` element would not trigger [destructor functions](/up.compiler#cleaning-up-after-yourself) in the old ``. - Fix a bug where [`[up-layer]`](/up-layer) attributes or `{ layer }` options were ignored. - [`a[up-target]`](/a-up-target) and [`form[up-target]`] get a new modifying attribute `[up-fail-layer]`. Use it to set the layer to update if the server sends a non-200 status code. Valid values are `auto`, `page`, `modal` and `popup`. - JavaScript functions like [`up.replace()`](/up.replace) or [`up.submit()`](/up.submit) now have a `{ failLayer }` option. 0.36.2 ------ ### Compatible changes - [Validating forms](https://unpoly.com/input-up-validate) will no longer change the scroll position. 0.36.1 ------ ### Compatible changes - [npm package](/install/npm) now expresses Unpoly's dependency on `jquery`. - [Modals](/up.modal) no longer close when clicking an element that exists outside the modal's DOM hierarchy. - Fix a bug on IE11 where modals would immediately close after opening if the opening link had an [`[up-instant]`](/a-up-instant) attribute and the destination page was already cached. 0.36.0 ------ ### Compatible changes - The [`[up-observe]`](/up-observe) attribute can now be set on a `
` to run a function if any contained input field changes. - Fix a bug where [`[up-autosubmit]`](/form-up-autosubmit) didn't honor an `[up-delay]` attribute if used on a form. - When [submitting a form](/form-up-target), the `name` and `value` of the submit button is now included with the form parameters. - [Going back in history](/up.history) after a [fragment update](/up.link) now always restores elements the page layer, never a selector in [modals](/up.modal) or [popups](/up.popup). - [Going back in history](/up.history) now always closes a [modal](/up.modal) or [popup](/up.popup). - Switch to [unpkg](https://unpkg.com) as our [CDN](/install/cdn). 0.35.2 ------ ### Compatible changes - `unpoly-rails` now supports Rails 5 0.35.1 ------ ### Compatible changes - Fix a bug where an Unpoly app would crash when embedded as an `