unpoly-rails 0.54.1 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/dist/unpoly.js +207 -96
- data/dist/unpoly.min.js +3 -3
- data/lib/assets/javascripts/unpoly/browser.coffee.erb +0 -1
- data/lib/assets/javascripts/unpoly/classes/extract_cascade.coffee +10 -22
- data/lib/assets/javascripts/unpoly/classes/extract_plan.coffee +57 -17
- data/lib/assets/javascripts/unpoly/classes/extract_step.coffee +4 -0
- data/lib/assets/javascripts/unpoly/link.coffee.erb +2 -2
- data/lib/assets/javascripts/unpoly/util.coffee +77 -26
- data/lib/unpoly/rails/version.rb +1 -1
- data/package.json +1 -1
- data/spec_app/Gemfile +1 -0
- data/spec_app/Gemfile.lock +3 -2
- data/spec_app/spec/javascripts/helpers/to_match_text.js.coffee +10 -0
- data/spec_app/spec/javascripts/up/dom_spec.js.coffee +331 -0
- data/spec_app/spec/javascripts/up/radio_spec.js.coffee +22 -0
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +165 -0
- metadata +4 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1fdee33cdc0082856a8323e4b98743dc38231346dd10a166c8abadaa03b70663
         | 
| 4 | 
            +
              data.tar.gz: ebd311b2afaedf289c35de0ed0b56d5e4ad6da81ba927ca174ecc44f2d192c7d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a2b40fc88ec64615aec1360710d669e9757c88673af1a0c319c37df744caf7838fd707638fd56634129564851c95881dca35e4890d449a5f77af9ad5e524c81d
         | 
| 7 | 
            +
              data.tar.gz: d5d04c17594f151a4104dfbac2e3280d9776b39b4fe653f36fce3ea8587dcbc877c3cab683ca20f22a586df87400e9ac839bde2233ac588ff388765599990cdd
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -6,6 +6,33 @@ Changes to this project will be documented in this file. | |
| 6 6 | 
             
            This project mostly adheres to [Semantic Versioning](http://semver.org/).
         | 
| 7 7 |  | 
| 8 8 |  | 
| 9 | 
            +
            Unreleased
         | 
| 10 | 
            +
            ----------
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ### Fragment updates
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            - Unpoly now detects when an [`[up-target]`](/up-target) with multiple selectors would [replace](/up.replace) the same element multiple times. In such a case the target selector will be shortened to contain the element once.
         | 
| 15 | 
            +
            - Unpoly now detects when an [`[up-target]`](/up-target) with multiple selectors contains nested elements. In such a case the target selector will be shortened to only contain the outmost element.
         | 
| 16 | 
            +
             | 
| 17 | 
            +
             | 
| 18 | 
            +
            ### Utility functions
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            - [`up.util.uniq()`](/up.util.uniq) now works on DOM elements and other object references.
         | 
| 21 | 
            +
            - New experimental function [`up.util.uniqBy()`](/up.util.uniqBy). This function is like [`uniq`](/up.util.uniq), accept that the given function is invoked for each element to generate the value for which uniquness is computed.
         | 
| 22 | 
            +
            - Changes to [utility functions](/up.util) that work on lists ([`up.util.each()`](/up.util.each), [`up.util.map()`](/up.util.map), [`up.util.all()`](/up.util.all), [`up.util.any()`](/up.util.any), [`up.util.select()`](/up.util.select), [`up.util.reject()`](/up.util.reject)):
         | 
| 23 | 
            +
              - List functions now accept a property name instead of a mapping function:
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                ```
         | 
| 26 | 
            +
                users = [{ name: 'foo' }, { name: 'bar' }]
         | 
| 27 | 
            +
                up.util.map(users, 'name') // ['foo', 'bar']
         | 
| 28 | 
            +
                ```
         | 
| 29 | 
            +
              - List functions now pass the iteration index as a second argument to the given function:
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                ```
         | 
| 32 | 
            +
                users = [{ name: 'foo' }, { name: 'bar' }]
         | 
| 33 | 
            +
                up.util.map(users, function(user, index) { return index }) // [0, 1]
         | 
| 34 | 
            +
                ```
         | 
| 35 | 
            +
             | 
| 9 36 | 
             
            0.54.1
         | 
| 10 37 | 
             
            ------
         | 
| 11 38 |  | 
    
        data/dist/unpoly.js
    CHANGED
    
    | @@ -5,7 +5,7 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            (function() {
         | 
| 7 7 | 
             
              window.up = {
         | 
| 8 | 
            -
                version: "0. | 
| 8 | 
            +
                version: "0.55.0",
         | 
| 9 9 | 
             
                renamedModule: function(oldName, newName) {
         | 
| 10 10 | 
             
                  return typeof Object.defineProperty === "function" ? Object.defineProperty(up, oldName, {
         | 
| 11 11 | 
             
                    get: function() {
         | 
| @@ -41,7 +41,7 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 41 41 | 
             
                @function up.util.noop
         | 
| 42 42 | 
             
                @experimental
         | 
| 43 43 | 
             
                 */
         | 
| 44 | 
            -
                var $createElementFromSelector, $createPlaceholder, $submittingButton, DivertibleChain, ESCAPE_HTML_ENTITY_MAP, all, always, any, appendRequestData, assign, assignPolyfill, attributeSelector, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElementFromHtml, cssAnimate, detachWith, detect, documentHasVerticalScrollbar, each, escapeHtml, escapePressed, evalOption, except, extractOptions, fail, fixedToAbsolute, flatten, forceCompositing, forceRepaint, horizontalScreenHalf, identity, intersect, isArray, isBlank, isBodyDescendant, isCrossDomain, isDefined, isDetached, isElement, isFixed, isFormData, isFunction, isGiven, isJQuery, isMissing, isNull, isNumber, isObject, isOptions, isPresent, isPromise, isStandardPort, isString, isTruthy, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, last, map, margins, measure, memoize, merge, mergeRequestData, methodAllowsPayload, microtask, multiSelector, muteRejection, newDeferred, nextFrame, nonUpClasses, noop, normalizeMethod, normalizeUrl, nullJQuery, offsetParent, once, only, opacity, openConfig, option, options, parseUrl, pluckData, pluckKey, presence, presentAttr, previewable, promiseTimer, reject, rejectOnError, remove, renameKey, requestDataAsArray, requestDataAsQuery, requestDataFromForm, scrollbarWidth, select, selectInDynasty, selectInSubtree, selectorForElement, sequence, setMissingAttrs, setTimer, submittedValue, temporaryCss, times, toArray, trim, unJQuery, uniq, unresolvablePromise, unwrapElement, whenReady;
         | 
| 44 | 
            +
                var $createElementFromSelector, $createPlaceholder, $submittingButton, DivertibleChain, ESCAPE_HTML_ENTITY_MAP, all, always, any, appendRequestData, assign, assignPolyfill, attributeSelector, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElementFromHtml, cssAnimate, detachWith, detect, documentHasVerticalScrollbar, each, escapeHtml, escapePressed, evalOption, except, extractOptions, fail, fixedToAbsolute, flatten, forceCompositing, forceRepaint, horizontalScreenHalf, identity, intersect, isArray, isBlank, isBodyDescendant, isCrossDomain, isDefined, isDetached, isElement, isFixed, isFormData, isFunction, isGiven, isJQuery, isMissing, isNull, isNumber, isObject, isOptions, isPresent, isPromise, isStandardPort, isString, isTruthy, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, last, listBlock, map, margins, measure, memoize, merge, mergeRequestData, methodAllowsPayload, microtask, multiSelector, muteRejection, newDeferred, nextFrame, nonUpClasses, noop, normalizeMethod, normalizeUrl, nullJQuery, offsetParent, once, only, opacity, openConfig, option, options, parseUrl, pluckData, pluckKey, presence, presentAttr, previewable, promiseTimer, reject, rejectOnError, remove, renameKey, requestDataAsArray, requestDataAsQuery, requestDataFromForm, scrollbarWidth, select, selectInDynasty, selectInSubtree, selectorForElement, sequence, setMissingAttrs, setTimer, setToArray, submittedValue, temporaryCss, times, toArray, trim, unJQuery, uniq, uniqBy, unresolvablePromise, unwrapElement, whenReady;
         | 
| 45 45 | 
             
                noop = $.noop;
         | 
| 46 46 |  | 
| 47 47 | 
             
                /***
         | 
| @@ -331,19 +331,33 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 331 331 | 
             
                @stable
         | 
| 332 332 | 
             
                 */
         | 
| 333 333 | 
             
                trim = $.trim;
         | 
| 334 | 
            +
                listBlock = function(block) {
         | 
| 335 | 
            +
                  if (isString(block)) {
         | 
| 336 | 
            +
                    return function(item) {
         | 
| 337 | 
            +
                      return item[block];
         | 
| 338 | 
            +
                    };
         | 
| 339 | 
            +
                  } else {
         | 
| 340 | 
            +
                    return block;
         | 
| 341 | 
            +
                  }
         | 
| 342 | 
            +
                };
         | 
| 334 343 |  | 
| 335 344 | 
             
                /***
         | 
| 336 | 
            -
                 | 
| 337 | 
            -
                of the given array.
         | 
| 345 | 
            +
                Translate all items in an array to new array of items.
         | 
| 338 346 |  | 
| 339 | 
            -
                @function up.util. | 
| 347 | 
            +
                @function up.util.map
         | 
| 340 348 | 
             
                @param {Array<T>} array
         | 
| 341 | 
            -
                @param {Function(T, number)} block
         | 
| 349 | 
            +
                @param {Function(T, number): any|String} block
         | 
| 342 350 | 
             
                  A function that will be called with each element and (optional) iteration index.
         | 
| 351 | 
            +
                
         | 
| 352 | 
            +
                  You can also pass a property name as a String,
         | 
| 353 | 
            +
                  which will be collected from each item in the array.
         | 
| 354 | 
            +
                @return {Array}
         | 
| 355 | 
            +
                  A new array containing the result of each function call.
         | 
| 343 356 | 
             
                @stable
         | 
| 344 357 | 
             
                 */
         | 
| 345 | 
            -
                 | 
| 358 | 
            +
                map = function(array, block) {
         | 
| 346 359 | 
             
                  var i, index, item, len, results;
         | 
| 360 | 
            +
                  block = listBlock(block);
         | 
| 347 361 | 
             
                  results = [];
         | 
| 348 362 | 
             
                  for (index = i = 0, len = array.length; i < len; index = ++i) {
         | 
| 349 363 | 
             
                    item = array[index];
         | 
| @@ -353,17 +367,16 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 353 367 | 
             
                };
         | 
| 354 368 |  | 
| 355 369 | 
             
                /***
         | 
| 356 | 
            -
                 | 
| 370 | 
            +
                Calls the given function for each element (and, optional, index)
         | 
| 371 | 
            +
                of the given array.
         | 
| 357 372 |  | 
| 358 | 
            -
                @function up.util. | 
| 373 | 
            +
                @function up.util.each
         | 
| 359 374 | 
             
                @param {Array<T>} array
         | 
| 360 | 
            -
                @param {Function(T, number) | 
| 375 | 
            +
                @param {Function(T, number)} block
         | 
| 361 376 | 
             
                  A function that will be called with each element and (optional) iteration index.
         | 
| 362 | 
            -
                @return {Array}
         | 
| 363 | 
            -
                  A new array containing the result of each function call.
         | 
| 364 377 | 
             
                @stable
         | 
| 365 378 | 
             
                 */
         | 
| 366 | 
            -
                 | 
| 379 | 
            +
                each = map;
         | 
| 367 380 |  | 
| 368 381 | 
             
                /***
         | 
| 369 382 | 
             
                Calls the given function for the given number of times.
         | 
| @@ -776,16 +789,19 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 776 789 |  | 
| 777 790 | 
             
                @function up.util.any
         | 
| 778 791 | 
             
                @param {Array<T>} array
         | 
| 779 | 
            -
                @param {Function(T): boolean} tester
         | 
| 792 | 
            +
                @param {Function(T, number): boolean} tester
         | 
| 793 | 
            +
                  A function that will be called with each element and (optional) iteration index.
         | 
| 794 | 
            +
                
         | 
| 780 795 | 
             
                @return {boolean}
         | 
| 781 796 | 
             
                @experimental
         | 
| 782 797 | 
             
                 */
         | 
| 783 798 | 
             
                any = function(array, tester) {
         | 
| 784 | 
            -
                  var element, i, len, match;
         | 
| 799 | 
            +
                  var element, i, index, len, match;
         | 
| 800 | 
            +
                  tester = listBlock(tester);
         | 
| 785 801 | 
             
                  match = false;
         | 
| 786 | 
            -
                  for (i = 0, len = array.length; i < len; i | 
| 787 | 
            -
                    element = array[ | 
| 788 | 
            -
                    if (tester(element)) {
         | 
| 802 | 
            +
                  for (index = i = 0, len = array.length; i < len; index = ++i) {
         | 
| 803 | 
            +
                    element = array[index];
         | 
| 804 | 
            +
                    if (tester(element, index)) {
         | 
| 789 805 | 
             
                      match = true;
         | 
| 790 806 | 
             
                      break;
         | 
| 791 807 | 
             
                    }
         | 
| @@ -799,16 +815,19 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 799 815 |  | 
| 800 816 | 
             
                @function up.util.all
         | 
| 801 817 | 
             
                @param {Array<T>} array
         | 
| 802 | 
            -
                @param {Function(T): boolean} tester
         | 
| 818 | 
            +
                @param {Function(T, number): boolean} tester
         | 
| 819 | 
            +
                  A function that will be called with each element and (optional) iteration index.
         | 
| 820 | 
            +
                
         | 
| 803 821 | 
             
                @return {boolean}
         | 
| 804 822 | 
             
                @experimental
         | 
| 805 823 | 
             
                 */
         | 
| 806 824 | 
             
                all = function(array, tester) {
         | 
| 807 | 
            -
                  var element, i, len, match;
         | 
| 825 | 
            +
                  var element, i, index, len, match;
         | 
| 826 | 
            +
                  tester = listBlock(tester);
         | 
| 808 827 | 
             
                  match = true;
         | 
| 809 | 
            -
                  for (i = 0, len = array.length; i < len; i | 
| 810 | 
            -
                    element = array[ | 
| 811 | 
            -
                    if (!tester(element)) {
         | 
| 828 | 
            +
                  for (index = i = 0, len = array.length; i < len; index = ++i) {
         | 
| 829 | 
            +
                    element = array[index];
         | 
| 830 | 
            +
                    if (!tester(element, index)) {
         | 
| 812 831 | 
             
                      match = false;
         | 
| 813 832 | 
             
                      break;
         | 
| 814 833 | 
             
                    }
         | 
| @@ -838,31 +857,73 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 838 857 | 
             
                @stable
         | 
| 839 858 | 
             
                 */
         | 
| 840 859 | 
             
                uniq = function(array) {
         | 
| 841 | 
            -
                  var  | 
| 842 | 
            -
                   | 
| 843 | 
            -
             | 
| 844 | 
            -
             | 
| 860 | 
            +
                  var set;
         | 
| 861 | 
            +
                  if (array.length < 2) {
         | 
| 862 | 
            +
                    return array;
         | 
| 863 | 
            +
                  }
         | 
| 864 | 
            +
                  set = new Set(array);
         | 
| 865 | 
            +
                  return setToArray(set);
         | 
| 866 | 
            +
                };
         | 
| 867 | 
            +
             | 
| 868 | 
            +
                /**
         | 
| 869 | 
            +
                This function is like [`uniq`](/up.util.uniq), accept that
         | 
| 870 | 
            +
                the given function is invoked for each element to generate the value
         | 
| 871 | 
            +
                for which uniquness is computed.
         | 
| 872 | 
            +
                
         | 
| 873 | 
            +
                @function up.util.uniqBy
         | 
| 874 | 
            +
                @param {Array<T>} array
         | 
| 875 | 
            +
                @param {Function<T>: any} array
         | 
| 876 | 
            +
                @return {Array<T>}
         | 
| 877 | 
            +
                @experimental
         | 
| 878 | 
            +
                 */
         | 
| 879 | 
            +
                uniqBy = function(array, mapper) {
         | 
| 880 | 
            +
                  var set;
         | 
| 881 | 
            +
                  if (array.length < 2) {
         | 
| 882 | 
            +
                    return array;
         | 
| 883 | 
            +
                  }
         | 
| 884 | 
            +
                  mapper = listBlock(mapper);
         | 
| 885 | 
            +
                  set = new Set();
         | 
| 886 | 
            +
                  return select(array, function(elem, index) {
         | 
| 887 | 
            +
                    var mapped;
         | 
| 888 | 
            +
                    mapped = mapper(elem, index);
         | 
| 889 | 
            +
                    if (set.has(mapped)) {
         | 
| 845 890 | 
             
                      return false;
         | 
| 846 891 | 
             
                    } else {
         | 
| 847 | 
            -
                       | 
| 892 | 
            +
                      set.add(mapped);
         | 
| 893 | 
            +
                      return true;
         | 
| 848 894 | 
             
                    }
         | 
| 849 895 | 
             
                  });
         | 
| 850 896 | 
             
                };
         | 
| 851 897 |  | 
| 898 | 
            +
                /**
         | 
| 899 | 
            +
                @function up.util.setToArray
         | 
| 900 | 
            +
                @internal
         | 
| 901 | 
            +
                 */
         | 
| 902 | 
            +
                setToArray = function(set) {
         | 
| 903 | 
            +
                  var array;
         | 
| 904 | 
            +
                  array = [];
         | 
| 905 | 
            +
                  set.forEach(function(elem) {
         | 
| 906 | 
            +
                    return array.push(elem);
         | 
| 907 | 
            +
                  });
         | 
| 908 | 
            +
                  return array;
         | 
| 909 | 
            +
                };
         | 
| 910 | 
            +
             | 
| 852 911 | 
             
                /***
         | 
| 853 912 | 
             
                Returns all elements from the given array that return
         | 
| 854 913 | 
             
                a truthy value when passed to the given function.
         | 
| 855 914 |  | 
| 856 915 | 
             
                @function up.util.select
         | 
| 857 916 | 
             
                @param {Array<T>} array
         | 
| 917 | 
            +
                @param {Function(T, number): boolean} tester
         | 
| 858 918 | 
             
                @return {Array<T>}
         | 
| 859 919 | 
             
                @stable
         | 
| 860 920 | 
             
                 */
         | 
| 861 921 | 
             
                select = function(array, tester) {
         | 
| 862 922 | 
             
                  var matches;
         | 
| 923 | 
            +
                  tester = listBlock(tester);
         | 
| 863 924 | 
             
                  matches = [];
         | 
| 864 | 
            -
                  each(array, function(element) {
         | 
| 865 | 
            -
                    if (tester(element)) {
         | 
| 925 | 
            +
                  each(array, function(element, index) {
         | 
| 926 | 
            +
                    if (tester(element, index)) {
         | 
| 866 927 | 
             
                      return matches.push(element);
         | 
| 867 928 | 
             
                    }
         | 
| 868 929 | 
             
                  });
         | 
| @@ -875,12 +936,14 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 875 936 |  | 
| 876 937 | 
             
                @function up.util.reject
         | 
| 877 938 | 
             
                @param {Array<T>} array
         | 
| 939 | 
            +
                @param {Function(T, number): boolean} tester
         | 
| 878 940 | 
             
                @return {Array<T>}
         | 
| 879 941 | 
             
                @stable
         | 
| 880 942 | 
             
                 */
         | 
| 881 943 | 
             
                reject = function(array, tester) {
         | 
| 882 | 
            -
                   | 
| 883 | 
            -
             | 
| 944 | 
            +
                  tester = listBlock(tester);
         | 
| 945 | 
            +
                  return select(array, function(element, index) {
         | 
| 946 | 
            +
                    return !tester(element, index);
         | 
| 884 947 | 
             
                  });
         | 
| 885 948 | 
             
                };
         | 
| 886 949 |  | 
| @@ -1848,7 +1911,7 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 1848 1911 | 
             
                 */
         | 
| 1849 1912 | 
             
                isDetached = function(element) {
         | 
| 1850 1913 | 
             
                  element = unJQuery(element);
         | 
| 1851 | 
            -
                  return  | 
| 1914 | 
            +
                  return !$.contains(document.documentElement, element);
         | 
| 1852 1915 | 
             
                };
         | 
| 1853 1916 |  | 
| 1854 1917 | 
             
                /***
         | 
| @@ -2076,17 +2139,17 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2076 2139 | 
             
                 * Registers an empty rejection handler with the given promise.
         | 
| 2077 2140 | 
             
                 * This prevents browsers from printing "Uncaught (in promise)" to the error
         | 
| 2078 2141 | 
             
                 * console when the promise is rejection.
         | 
| 2079 | 
            -
             | 
| 2142 | 
            +
                #
         | 
| 2080 2143 | 
             
                 * This is helpful for event handlers where it is clear that no rejection
         | 
| 2081 2144 | 
             
                 * handler will be registered:
         | 
| 2082 | 
            -
             | 
| 2145 | 
            +
                #
         | 
| 2083 2146 | 
             
                 *     up.on('submit', 'form[up-target]', (event, $form) => {
         | 
| 2084 2147 | 
             
                 *       promise = up.submit($form)
         | 
| 2085 2148 | 
             
                 *       up.util.muteRejection(promise)
         | 
| 2086 2149 | 
             
                 *     })
         | 
| 2087 | 
            -
             | 
| 2150 | 
            +
                #
         | 
| 2088 2151 | 
             
                 * Does nothing if passed a missing value.
         | 
| 2089 | 
            -
             | 
| 2152 | 
            +
                #
         | 
| 2090 2153 | 
             
                 * @function up.util.muteRejection
         | 
| 2091 2154 | 
             
                 * @param {Promise|undefined|null} promise
         | 
| 2092 2155 | 
             
                 * @return {Promise}
         | 
| @@ -2126,8 +2189,8 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2126 2189 | 
             
                  var error;
         | 
| 2127 2190 | 
             
                  try {
         | 
| 2128 2191 | 
             
                    return block();
         | 
| 2129 | 
            -
                  } catch ( | 
| 2130 | 
            -
                    error =  | 
| 2192 | 
            +
                  } catch (_error) {
         | 
| 2193 | 
            +
                    error = _error;
         | 
| 2131 2194 | 
             
                    return Promise.reject(error);
         | 
| 2132 2195 | 
             
                  }
         | 
| 2133 2196 | 
             
                };
         | 
| @@ -2177,6 +2240,7 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2177 2240 | 
             
                  intersect: intersect,
         | 
| 2178 2241 | 
             
                  compact: compact,
         | 
| 2179 2242 | 
             
                  uniq: uniq,
         | 
| 2243 | 
            +
                  uniqBy: uniqBy,
         | 
| 2180 2244 | 
             
                  last: last,
         | 
| 2181 2245 | 
             
                  isNull: isNull,
         | 
| 2182 2246 | 
             
                  isDefined: isDefined,
         | 
| @@ -2471,7 +2535,6 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2471 2535 | 
             
                function ExtractCascade(selector, options) {
         | 
| 2472 2536 | 
             
                  this.oldPlanNotFound = bind(this.oldPlanNotFound, this);
         | 
| 2473 2537 | 
             
                  this.matchingPlanNotFound = bind(this.matchingPlanNotFound, this);
         | 
| 2474 | 
            -
                  this.hungrySteps = bind(this.hungrySteps, this);
         | 
| 2475 2538 | 
             
                  this.bestMatchingSteps = bind(this.bestMatchingSteps, this);
         | 
| 2476 2539 | 
             
                  this.bestPreflightSelector = bind(this.bestPreflightSelector, this);
         | 
| 2477 2540 | 
             
                  this.detectPlan = bind(this.detectPlan, this);
         | 
| @@ -2530,9 +2593,13 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2530 2593 | 
             
                ExtractCascade.prototype.bestPreflightSelector = function() {
         | 
| 2531 2594 | 
             
                  var plan;
         | 
| 2532 2595 | 
             
                  if (this.options.provideTarget) {
         | 
| 2533 | 
            -
                     | 
| 2534 | 
            -
                  } else  | 
| 2535 | 
            -
                     | 
| 2596 | 
            +
                    plan = this.plans[0];
         | 
| 2597 | 
            +
                  } else {
         | 
| 2598 | 
            +
                    plan = this.oldPlan();
         | 
| 2599 | 
            +
                  }
         | 
| 2600 | 
            +
                  if (plan) {
         | 
| 2601 | 
            +
                    plan.resolveNesting();
         | 
| 2602 | 
            +
                    return plan.selector();
         | 
| 2536 2603 | 
             
                  } else {
         | 
| 2537 2604 | 
             
                    return this.oldPlanNotFound();
         | 
| 2538 2605 | 
             
                  }
         | 
| @@ -2541,37 +2608,14 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2541 2608 | 
             
                ExtractCascade.prototype.bestMatchingSteps = function() {
         | 
| 2542 2609 | 
             
                  var plan;
         | 
| 2543 2610 | 
             
                  if (plan = this.matchingPlan()) {
         | 
| 2544 | 
            -
                     | 
| 2611 | 
            +
                    plan.addHungrySteps();
         | 
| 2612 | 
            +
                    plan.resolveNesting();
         | 
| 2613 | 
            +
                    return plan.steps;
         | 
| 2545 2614 | 
             
                  } else {
         | 
| 2546 2615 | 
             
                    return this.matchingPlanNotFound();
         | 
| 2547 2616 | 
             
                  }
         | 
| 2548 2617 | 
             
                };
         | 
| 2549 2618 |  | 
| 2550 | 
            -
                ExtractCascade.prototype.hungrySteps = function() {
         | 
| 2551 | 
            -
                  var $hungries, $hungry, $newHungry, hungry, j, len, selector, steps, transition;
         | 
| 2552 | 
            -
                  steps = [];
         | 
| 2553 | 
            -
                  if (this.options.hungry) {
         | 
| 2554 | 
            -
                    $hungries = up.radio.hungrySelector().select();
         | 
| 2555 | 
            -
                    for (j = 0, len = $hungries.length; j < len; j++) {
         | 
| 2556 | 
            -
                      hungry = $hungries[j];
         | 
| 2557 | 
            -
                      $hungry = $(hungry);
         | 
| 2558 | 
            -
                      selector = u.selectorForElement($hungry);
         | 
| 2559 | 
            -
                      if ($newHungry = this.options.response.first(selector)) {
         | 
| 2560 | 
            -
                        transition = u.option(up.radio.config.hungryTransition, this.options.transition);
         | 
| 2561 | 
            -
                        steps.push({
         | 
| 2562 | 
            -
                          selector: selector,
         | 
| 2563 | 
            -
                          $old: $hungry,
         | 
| 2564 | 
            -
                          $new: $newHungry,
         | 
| 2565 | 
            -
                          transition: transition,
         | 
| 2566 | 
            -
                          reveal: false,
         | 
| 2567 | 
            -
                          origin: null
         | 
| 2568 | 
            -
                        });
         | 
| 2569 | 
            -
                      }
         | 
| 2570 | 
            -
                    }
         | 
| 2571 | 
            -
                  }
         | 
| 2572 | 
            -
                  return steps;
         | 
| 2573 | 
            -
                };
         | 
| 2574 | 
            -
             | 
| 2575 2619 | 
             
                ExtractCascade.prototype.matchingPlanNotFound = function() {
         | 
| 2576 2620 | 
             
                  var inspectAction, message;
         | 
| 2577 2621 | 
             
                  if (this.newPlan()) {
         | 
| @@ -2616,19 +2660,25 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2616 2660 |  | 
| 2617 2661 | 
             
              up.ExtractPlan = (function() {
         | 
| 2618 2662 | 
             
                function ExtractPlan(selector, options) {
         | 
| 2663 | 
            +
                  this.addHungrySteps = bind(this.addHungrySteps, this);
         | 
| 2619 2664 | 
             
                  this.parseSteps = bind(this.parseSteps, this);
         | 
| 2665 | 
            +
                  this.selector = bind(this.selector, this);
         | 
| 2666 | 
            +
                  this.resolveNesting = bind(this.resolveNesting, this);
         | 
| 2667 | 
            +
                  this.addSteps = bind(this.addSteps, this);
         | 
| 2620 2668 | 
             
                  this.matchExists = bind(this.matchExists, this);
         | 
| 2621 2669 | 
             
                  this.newExists = bind(this.newExists, this);
         | 
| 2622 2670 | 
             
                  this.oldExists = bind(this.oldExists, this);
         | 
| 2623 2671 | 
             
                  this.findNew = bind(this.findNew, this);
         | 
| 2624 2672 | 
             
                  this.findOld = bind(this.findOld, this);
         | 
| 2673 | 
            +
                  var originalSelector;
         | 
| 2625 2674 | 
             
                  this.reveal = options.reveal;
         | 
| 2626 2675 | 
             
                  this.origin = options.origin;
         | 
| 2627 | 
            -
                  this. | 
| 2676 | 
            +
                  this.hungry = options.hungry;
         | 
| 2628 2677 | 
             
                  this.transition = options.transition;
         | 
| 2629 2678 | 
             
                  this.response = options.response;
         | 
| 2630 2679 | 
             
                  this.oldLayer = options.layer;
         | 
| 2631 | 
            -
                  this. | 
| 2680 | 
            +
                  originalSelector = up.dom.resolveSelector(selector, this.origin);
         | 
| 2681 | 
            +
                  this.parseSteps(originalSelector);
         | 
| 2632 2682 | 
             
                }
         | 
| 2633 2683 |  | 
| 2634 2684 | 
             
                ExtractPlan.prototype.findOld = function() {
         | 
| @@ -2667,35 +2717,59 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2667 2717 | 
             
                  return this.oldExists() && this.newExists();
         | 
| 2668 2718 | 
             
                };
         | 
| 2669 2719 |  | 
| 2720 | 
            +
                ExtractPlan.prototype.addSteps = function(steps) {
         | 
| 2721 | 
            +
                  return this.steps = this.steps.concat(steps);
         | 
| 2722 | 
            +
                };
         | 
| 2670 2723 |  | 
| 2671 | 
            -
                 | 
| 2672 | 
            -
             | 
| 2673 | 
            -
             | 
| 2674 | 
            -
                     | 
| 2675 | 
            -
             | 
| 2676 | 
            -
             | 
| 2677 | 
            -
             | 
| 2678 | 
            -
             | 
| 2679 | 
            -
             | 
| 2680 | 
            -
             | 
| 2724 | 
            +
                ExtractPlan.prototype.resolveNesting = function() {
         | 
| 2725 | 
            +
                  var compressed;
         | 
| 2726 | 
            +
                  if (this.steps.length < 2) {
         | 
| 2727 | 
            +
                    return;
         | 
| 2728 | 
            +
                  }
         | 
| 2729 | 
            +
                  compressed = u.copy(this.steps);
         | 
| 2730 | 
            +
                  compressed = u.uniqBy(compressed, function(step) {
         | 
| 2731 | 
            +
                    return step.$old[0];
         | 
| 2732 | 
            +
                  });
         | 
| 2733 | 
            +
                  compressed = u.select(compressed, (function(_this) {
         | 
| 2734 | 
            +
                    return function(candidateStep, candidateIndex) {
         | 
| 2735 | 
            +
                      return u.all(compressed, function(rivalStep, rivalIndex) {
         | 
| 2736 | 
            +
                        var candidateElement, rivalElement;
         | 
| 2737 | 
            +
                        if (rivalIndex === candidateIndex) {
         | 
| 2738 | 
            +
                          return true;
         | 
| 2739 | 
            +
                        } else {
         | 
| 2740 | 
            +
                          candidateElement = candidateStep.$old[0];
         | 
| 2741 | 
            +
                          rivalElement = rivalStep.$old[0];
         | 
| 2742 | 
            +
                          return rivalStep.pseudoClass || !$.contains(rivalElement, candidateElement);
         | 
| 2743 | 
            +
                        }
         | 
| 2744 | 
            +
                      });
         | 
| 2745 | 
            +
                    };
         | 
| 2746 | 
            +
                  })(this));
         | 
| 2747 | 
            +
                  compressed[0].reveal = this.steps[0].reveal;
         | 
| 2748 | 
            +
                  return this.steps = compressed;
         | 
| 2749 | 
            +
                };
         | 
| 2681 2750 |  | 
| 2682 | 
            -
                ExtractPlan.prototype. | 
| 2751 | 
            +
                ExtractPlan.prototype.selector = function() {
         | 
| 2752 | 
            +
                  return u.map(this.steps, 'expression').join(', ');
         | 
| 2753 | 
            +
                };
         | 
| 2754 | 
            +
             | 
| 2755 | 
            +
                ExtractPlan.prototype.parseSteps = function(originalSelector) {
         | 
| 2683 2756 | 
             
                  var comma, disjunction;
         | 
| 2684 2757 | 
             
                  comma = /\ *,\ */;
         | 
| 2685 2758 | 
             
                  this.steps = [];
         | 
| 2686 | 
            -
                  disjunction =  | 
| 2759 | 
            +
                  disjunction = originalSelector.split(comma);
         | 
| 2687 2760 | 
             
                  return u.each(disjunction, (function(_this) {
         | 
| 2688 | 
            -
                    return function( | 
| 2689 | 
            -
                      var doReveal,  | 
| 2690 | 
            -
                       | 
| 2691 | 
            -
                       | 
| 2692 | 
            -
                      selector =  | 
| 2761 | 
            +
                    return function(expression, i) {
         | 
| 2762 | 
            +
                      var doReveal, expressionParts, pseudoClass, selector;
         | 
| 2763 | 
            +
                      expressionParts = expression.match(/^(.+?)(?:\:(before|after))?$/);
         | 
| 2764 | 
            +
                      expressionParts || up.fail('Could not parse selector literal "%s"', expression);
         | 
| 2765 | 
            +
                      selector = expressionParts[1];
         | 
| 2693 2766 | 
             
                      if (selector === 'html') {
         | 
| 2694 2767 | 
             
                        selector = 'body';
         | 
| 2695 2768 | 
             
                      }
         | 
| 2696 | 
            -
                      pseudoClass =  | 
| 2769 | 
            +
                      pseudoClass = expressionParts[2];
         | 
| 2697 2770 | 
             
                      doReveal = i === 0 ? _this.reveal : false;
         | 
| 2698 2771 | 
             
                      return _this.steps.push({
         | 
| 2772 | 
            +
                        expression: expression,
         | 
| 2699 2773 | 
             
                        selector: selector,
         | 
| 2700 2774 | 
             
                        pseudoClass: pseudoClass,
         | 
| 2701 2775 | 
             
                        transition: _this.transition,
         | 
| @@ -2706,10 +2780,48 @@ that might save you from loading something like [Lodash](https://lodash.com/). | |
| 2706 2780 | 
             
                  })(this));
         | 
| 2707 2781 | 
             
                };
         | 
| 2708 2782 |  | 
| 2783 | 
            +
                ExtractPlan.prototype.addHungrySteps = function() {
         | 
| 2784 | 
            +
                  var $hungries, $hungry, $newHungry, hungry, hungrySteps, j, len, selector, transition;
         | 
| 2785 | 
            +
                  hungrySteps = [];
         | 
| 2786 | 
            +
                  if (this.hungry) {
         | 
| 2787 | 
            +
                    $hungries = up.radio.hungrySelector().select();
         | 
| 2788 | 
            +
                    transition = u.option(up.radio.config.hungryTransition, this.transition);
         | 
| 2789 | 
            +
                    for (j = 0, len = $hungries.length; j < len; j++) {
         | 
| 2790 | 
            +
                      hungry = $hungries[j];
         | 
| 2791 | 
            +
                      $hungry = $(hungry);
         | 
| 2792 | 
            +
                      selector = u.selectorForElement($hungry);
         | 
| 2793 | 
            +
                      if ($newHungry = this.response.first(selector)) {
         | 
| 2794 | 
            +
                        hungrySteps.push({
         | 
| 2795 | 
            +
                          selector: selector,
         | 
| 2796 | 
            +
                          $old: $hungry,
         | 
| 2797 | 
            +
                          $new: $newHungry,
         | 
| 2798 | 
            +
                          transition: transition,
         | 
| 2799 | 
            +
                          reveal: false,
         | 
| 2800 | 
            +
                          origin: null
         | 
| 2801 | 
            +
                        });
         | 
| 2802 | 
            +
                      }
         | 
| 2803 | 
            +
                    }
         | 
| 2804 | 
            +
                  }
         | 
| 2805 | 
            +
                  return this.addSteps(hungrySteps);
         | 
| 2806 | 
            +
                };
         | 
| 2807 | 
            +
             | 
| 2709 2808 | 
             
                return ExtractPlan;
         | 
| 2710 2809 |  | 
| 2711 2810 | 
             
              })();
         | 
| 2712 2811 |  | 
| 2812 | 
            +
            }).call(this);
         | 
| 2813 | 
            +
            (function() {
         | 
| 2814 | 
            +
              var u;
         | 
| 2815 | 
            +
             | 
| 2816 | 
            +
              u = up.util;
         | 
| 2817 | 
            +
             | 
| 2818 | 
            +
              up.ExtractStep = (function() {
         | 
| 2819 | 
            +
                function ExtractStep() {}
         | 
| 2820 | 
            +
             | 
| 2821 | 
            +
                return ExtractStep;
         | 
| 2822 | 
            +
             | 
| 2823 | 
            +
              })();
         | 
| 2824 | 
            +
             | 
| 2713 2825 | 
             
            }).call(this);
         | 
| 2714 2826 | 
             
            (function() {
         | 
| 2715 2827 | 
             
              var u,
         | 
| @@ -3852,7 +3964,7 @@ Internet Explorer 10 or lower | |
| 3852 3964 | 
             
                sessionStorage = u.memoize(function() {
         | 
| 3853 3965 | 
             
                  try {
         | 
| 3854 3966 | 
             
                    return window.sessionStorage;
         | 
| 3855 | 
            -
                  } catch ( | 
| 3967 | 
            +
                  } catch (_error) {
         | 
| 3856 3968 | 
             
                    return polyfilledSessionStorage();
         | 
| 3857 3969 | 
             
                  }
         | 
| 3858 3970 | 
             
                });
         | 
| @@ -3901,8 +4013,7 @@ Internet Explorer 10 or lower | |
| 3901 4013 | 
             
                  sprintfWithFormattedArgs: sprintfWithFormattedArgs,
         | 
| 3902 4014 | 
             
                  sessionStorage: sessionStorage,
         | 
| 3903 4015 | 
             
                  popCookie: popCookie,
         | 
| 3904 | 
            -
                  hash: hash | 
| 3905 | 
            -
                  canPushState: canPushState
         | 
| 4016 | 
            +
                  hash: hash
         | 
| 3906 4017 | 
             
                };
         | 
| 3907 4018 | 
             
              })(jQuery);
         | 
| 3908 4019 |  | 
| @@ -6923,8 +7034,8 @@ is built from these functions. You can use them to extend Unpoly from your | |
| 6923 7034 | 
             
                  try {
         | 
| 6924 7035 | 
             
                    improvedTarget = bestPreflightSelector(selectorOrElement, successOptions);
         | 
| 6925 7036 | 
             
                    improvedFailTarget = bestPreflightSelector(options.failTarget, failureOptions);
         | 
| 6926 | 
            -
                  } catch ( | 
| 6927 | 
            -
                    e =  | 
| 7037 | 
            +
                  } catch (_error) {
         | 
| 7038 | 
            +
                    e = _error;
         | 
| 6928 7039 | 
             
                    return Promise.reject(e);
         | 
| 6929 7040 | 
             
                  }
         | 
| 6930 7041 | 
             
                  request = {
         | 
| @@ -9399,8 +9510,8 @@ new page is loading. | |
| 9399 9510 | 
             
                @function up.link.addFollowVariant
         | 
| 9400 9511 | 
             
                @param {string} simplifiedSelector
         | 
| 9401 9512 | 
             
                  A selector without `a` or `[up-href]`, e.g. `[up-target]`
         | 
| 9402 | 
            -
                @param {Function | 
| 9403 | 
            -
                @param {Function | 
| 9513 | 
            +
                @param {Function(jQuery, Object)} options.follow
         | 
| 9514 | 
            +
                @param {Function(jQuery, Object)} options.preload
         | 
| 9404 9515 | 
             
                @internal
         | 
| 9405 9516 | 
             
                 */
         | 
| 9406 9517 | 
             
                addFollowVariant = function(simplifiedSelector, options) {
         |