Revision code

Changes Version 0.55.0
Released on April 05, 2018 with 4 commits

Fragment updates

  • Unpoly now detects when an [up-target] with multiple selectors would replace the same element multiple times. In such a case the target selector will be shortened to contain the element once.
  • Unpoly now detects when an [up-target] with multiple selectors contains nested elements. In such a case the target selector will be shortened to only contain the outmost element.

Utility functions

  • up.util.uniq() now works on DOM elements and other object references.
  • New experimental function up.util.uniqBy(). This function is like uniq, accept that the given function is invoked for each element to generate the value for which uniquness is computed.
  • Changes to utility functions that work on lists (up.util.each(), up.util.map(), up.util.all(), up.util.any(), up.util.select(), up.util.reject()):
    • List functions now accept a property name instead of a mapping function:

      users = [{ name: 'foo' }, { name: 'bar' }]
      up.util.map(users, 'name') // ['foo', 'bar']
      
    • List functions now pass the iteration index as a second argument to the given function:

      users = [{ name: 'foo' }, { name: 'bar' }]
      up.util.map(users, function(user, index) { return index }) // [0, 1]
      

Upgrading

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.