unpoly-rails 0.62.0 → 1.0.3

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.

Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -0
  3. data/Gemfile +0 -1
  4. data/Gemfile.lock +1 -7
  5. data/README.md +7 -6
  6. data/Rakefile +11 -2
  7. data/dist/unpoly.js +75 -49
  8. data/dist/unpoly.min.js +4 -4
  9. data/lib/assets/javascripts/unpoly/classes/body_shifter.coffee +21 -12
  10. data/lib/assets/javascripts/unpoly/classes/params.coffee.erb +1 -0
  11. data/lib/assets/javascripts/unpoly/classes/request.coffee +1 -0
  12. data/lib/assets/javascripts/unpoly/element.coffee.erb +5 -2
  13. data/lib/assets/javascripts/unpoly/form.coffee.erb +16 -1
  14. data/lib/assets/javascripts/unpoly/framework.coffee +8 -10
  15. data/lib/assets/javascripts/unpoly/log.coffee +7 -2
  16. data/lib/assets/javascripts/unpoly/modal.coffee.erb +1 -0
  17. data/lib/assets/javascripts/unpoly/motion.coffee.erb +1 -1
  18. data/lib/assets/javascripts/unpoly/protocol.coffee +2 -0
  19. data/lib/assets/javascripts/unpoly/syntax.coffee.erb +2 -3
  20. data/lib/assets/javascripts/unpoly/util.coffee.erb +2 -1
  21. data/lib/unpoly/rails/version.rb +1 -1
  22. data/package.json +1 -1
  23. data/spec_app/Gemfile +0 -1
  24. data/spec_app/Gemfile.lock +1 -7
  25. data/spec_app/app/assets/javascripts/integration_test.coffee +0 -1
  26. data/spec_app/app/controllers/boot_test_controller.rb +31 -0
  27. data/spec_app/app/controllers/pages_controller.rb +8 -0
  28. data/spec_app/app/helpers/application_helper.rb +9 -0
  29. data/spec_app/app/views/boot_test/defer.erb +18 -0
  30. data/spec_app/app/views/boot_test/module.erb +18 -0
  31. data/spec_app/app/views/boot_test/sync.erb +17 -0
  32. data/spec_app/app/views/compiler_test/timestamp.erb +1 -0
  33. data/spec_app/app/views/css_test/modal.erb +1 -1
  34. data/spec_app/app/views/css_test/popup.erb +1 -1
  35. data/spec_app/app/views/form_test/redirects/target.erb +2 -0
  36. data/spec_app/app/views/layouts/integration_test.erb +3 -3
  37. data/spec_app/app/views/pages/start.erb +3 -0
  38. data/spec_app/config/routes.rb +3 -0
  39. data/spec_app/spec/javascripts/helpers/knife.js.coffee +1 -1
  40. data/spec_app/spec/javascripts/up/fragment_spec.js.coffee +14 -1
  41. data/spec_app/spec/javascripts/up/modal_spec.js.coffee +21 -0
  42. data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +8 -0
  43. data/spec_app/spec/javascripts/up/util_spec.js.coffee +14 -0
  44. metadata +7 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 550a7dc0636e2a9775132e49cdd0dd0def39be7772c24f0b58f361045753d30a
4
- data.tar.gz: 90450c13bc60983f7763a85415ff9f45b3fc6ef500874a0b7c9e8934096abb12
3
+ metadata.gz: 91eeb3a0e727e868391bd42e37a86e7ed8cc1c7f9644a09b22e0a653d36b2ceb
4
+ data.tar.gz: a0e38887ff10a26a461311a4f73cb6e7d17ddac40fffb0a7e44e77a674a73c8f
5
5
  SHA512:
6
- metadata.gz: f66c2c21e85749d2fe2f2f9e6c265b0278aea11e6d49c2e45d46165776ad18c952ac3ab5065f680a00c6c41f91e8dd4a4c9efb6be867da428f6910316d42fb5d
7
- data.tar.gz: aa3f05e3eb78629f8ce81d438fc1f5e5ee9714bcba51fae49dfe7751b286f2b78592cfd81b96a17cd574491ef83e62d193d9c8be56647d0a8afb1be1f78cf4c1
6
+ metadata.gz: c00b889747a5cd70a5c93e6a31478dc609aad7046c9ce4334724f6b39ef398678246936b8152c0a08d1284976a736521ce5f994959b19d66f384f0625f349c40
7
+ data.tar.gz: a65dda307897f584bee082d909ddfcbc5fc606487ead7916a298d7d10445e83f5c60bc63a60bed896ef26c6c57d5c2c52038eca271bf0bac6d23fc7c2aa2fc64
data/CHANGELOG.md CHANGED
@@ -6,6 +6,53 @@ Changes to this project will be documented in this file.
6
6
  You may browse a formatted and hyperlinked version of this file at <https://unpoly.com/changes>.
7
7
 
8
8
 
9
+ 1.0.3
10
+ -----
11
+
12
+ This maintenance release addresses two issues that were introduced in version 1.0.0:
13
+
14
+ - Unpoly can now be loaded with `<script defer>`. This can be used to load your scripts without blocking the DOM parser.
15
+ - Unpoly can now be loaded with `<script type="module">`. This can be used deliver a modern JS build to modern browsers only.
16
+
17
+
18
+ 1.0.1
19
+ -----
20
+
21
+ This is a maintenance release for Unpoly 1. Expect little to no additional changes for this legacy version. New features will only be added to Unpoly 2.
22
+
23
+ - `up.request()` will now send Unpoly's version number as an `X-Up-Version` request header. Since `X-Up-Target` is optional in Unpoly 2, server-side integration libraries can look for `X-Up-Version` to reliably detect a fragment update for both Unpoly 1 and 2.
24
+ - Fix a bug where the Unpoly banner would still be printed to the development console when `up.log.config.banner = false` is set. (fix by @adam12)
25
+
26
+
27
+ 1.0.0
28
+ -----
29
+
30
+ For six years Unpoly has been released under a 0.x version number. To establish the maturity and stability of the project, we're releasing today's version as 1.0.0.
31
+
32
+ There are only three changes from 0.62.1:
33
+
34
+ - Fix a bug where `up.util.escapeHTML()` would not escape single quotes.
35
+ - Unpoly will no longer wait a JavaScript execution task to boot after `DOMContentLoaded`. This may improve the stability of test suites that previously interacted with the page too soon.
36
+ - You may now disable the Unpoly banner in the development console with `up.log.config.banner = false`. (change by @hfjallemark).
37
+
38
+ This is the last release of the 0.x API line. We're tracking its code in the [`1.x-stable`](https://github.com/unpoly/unpoly/tree/1.x-stable), but expect little to no changes in the future.
39
+
40
+ The next release will be [Unpoly 2](https://triskweline.de/unpoly2-slides). It will include major (but mostly backwards compatible) renovations to its API, unlocking many use cases that were not possible with Unpoly 1.
41
+
42
+
43
+ 0.62.1
44
+ ------
45
+
46
+ This is another maintenance release while we're finishing [the next major version of Unpoly](https://groups.google.com/forum/#!topic/unpoly/FDdVjxbjNLg).
47
+
48
+ Community members were involved in every change of this release:
49
+
50
+ - [`up.submit()`](/up.submit) has a new options `{ params }`. It may be used to pass extra form [parameters](/up.Params) that will be submitted in addition to the parameters from the form. (fix by @robinvdvleuten)
51
+ - [`a[up-modal]`](/a-up-modal) will now honor an [`[up-cache]`](/a-up-target#up-cache) attribute on the same link. (fix by @adam12)
52
+ - Prevent destructor function from being called twice if [`up.destroy()`](/up.destroy) is called twice with the same element (reported by @kratob)
53
+ - On devices that don't show a vertical scrollbar, users can no longer scroll the underlying page while a [modal overlay](/up.modal) is open. (reported by @msurdi)
54
+
55
+
9
56
  0.62.0
10
57
  ------
11
58
 
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rack'
4
- gem 'therubyracer'
5
4
  gem 'sass'
6
5
  gem 'uglifier'
7
6
  gem 'coffee-script'
data/Gemfile.lock CHANGED
@@ -8,11 +8,9 @@ GEM
8
8
  execjs (2.7.0)
9
9
  hike (1.2.3)
10
10
  json (1.8.2)
11
- libv8 (3.16.14.11)
12
11
  multi_json (1.10.1)
13
12
  rack (1.6.0)
14
13
  rake (10.4.2)
15
- ref (1.0.5)
16
14
  sass (3.4.11)
17
15
  sprockets (2.12.3)
18
16
  hike (~> 1.2)
@@ -22,9 +20,6 @@ GEM
22
20
  sprockets-standalone (1.2.1)
23
21
  rake
24
22
  sprockets (~> 2.0)
25
- therubyracer (0.12.1)
26
- libv8 (~> 3.16.14.0)
27
- ref
28
23
  tilt (1.4.1)
29
24
  uglifier (2.7.0)
30
25
  execjs (>= 0.3.0)
@@ -38,8 +33,7 @@ DEPENDENCIES
38
33
  rack
39
34
  sass
40
35
  sprockets-standalone
41
- therubyracer
42
36
  uglifier
43
37
 
44
38
  BUNDLED WITH
45
- 1.16.1
39
+ 1.17.3
data/README.md CHANGED
@@ -31,8 +31,9 @@ Overview:
31
31
 
32
32
  Install dependencies for tests:
33
33
 
34
- - Install Ruby 2.1.2
34
+ - Install Ruby 2.3.8
35
35
  - Install Bundler by running `gem install bundler`
36
+ - Install Node.js (required for building the library)
36
37
  - `cd` into `spec_app`
37
38
  - Install dependencies by running `bundle install`
38
39
 
@@ -50,11 +51,9 @@ To run RSpec tests for the `unpoly-rails` gem:
50
51
 
51
52
  ### Making a new release
52
53
 
53
- We are currently feeding four release channels:
54
+ We are currently feeding the following release channels:
54
55
 
55
- - Manual download from GitHub
56
56
  - npm
57
- - Bower (which is based on Git and version tags)
58
57
  - Rubygems (as the `unpoly-rails` gem)
59
58
 
60
59
  We always release to all channel simultaneously.
@@ -64,6 +63,7 @@ To prepare a new version:
64
63
  1. Edit `lib/unpoly/rails/version.rb` and bump the version number. Use [semantic versioning](http://semver.org/).
65
64
  2. Add an entry to `CHANGELOG.md`
66
65
  3. Commit and push the version bump and `CHANGELOG.md`
66
+ 4. Merge the relevant `CHANGEOG.md` entries to the `master` branch (since [unpoly.com](https://unpoly.com) builds from there)
67
67
 
68
68
  Now we can release a new version. **This requires your to be logged into Rubygems and npm**:
69
69
 
@@ -78,8 +78,9 @@ If you have done this process a few times and know what you're doing, you can ca
78
78
 
79
79
  After you have published all release channels, remember to:
80
80
 
81
- 1. Update [unpoly.com](https://unpoly.com/) so users see the new version, CDN link and CHANGELOG.
82
- 2. Send a message to the [E-mail group](https://groups.google.com/group/unpoly) with the title "Unpoly X.Y.Z released". You can copy the relevant CHANGELOG part from [here](http://localhost:4567/changes_google_groups).
81
+ 1. Deploy to [unpoly.com](https://unpoly.com/)
82
+ 2. Deploy to [v1.unpoly.com](https://unpoly.com/)
83
+ 3. Send a message to the [E-mail group](https://groups.google.com/group/unpoly) with the title "Unpoly X.Y.Z released". You can copy the relevant CHANGELOG part from [here](http://localhost:4567/changes_google_groups).
83
84
 
84
85
 
85
86
  Credits
data/Rakefile CHANGED
@@ -99,7 +99,7 @@ namespace :publish do
99
99
 
100
100
  desc 'Release new version to all package managers'
101
101
  task :release do
102
- Rake::Task['release'].invoke
102
+ Rake::Task['rubygems:publish'].invoke
103
103
  Rake::Task['npm:publish'].invoke
104
104
  end
105
105
 
@@ -117,6 +117,15 @@ namespace :publish do
117
117
 
118
118
  end
119
119
 
120
+ namespace :rubygems do
121
+
122
+ task :publish do
123
+ puts 'Publishing to rubygems.org. If this seems to hang, enter your 2FA token.'
124
+ Rake::Task['release'].invoke
125
+ end
126
+
127
+ end
128
+
120
129
  namespace :npm do
121
130
 
122
131
  task :bump_version do
@@ -132,7 +141,7 @@ namespace :npm do
132
141
  end
133
142
 
134
143
  task :publish do
135
- system('npm publish') or raise 'Could not publish npm module'
144
+ system('npm publish --tag 1.x-stable') or raise 'Could not publish npm module'
136
145
  end
137
146
 
138
147
  end
data/dist/unpoly.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  (function() {
7
7
  window.up = {
8
- version: "0.62.0"
8
+ version: "1.0.3"
9
9
  };
10
10
 
11
11
  }).call(this);
@@ -1305,7 +1305,8 @@ to not include another library in your asset bundle.
1305
1305
  "&": "&amp;",
1306
1306
  "<": "&lt;",
1307
1307
  ">": "&gt;",
1308
- '"': '&quot;'
1308
+ '"': '&quot;',
1309
+ "'": '&#x27;'
1309
1310
  };
1310
1311
 
1311
1312
  /***
@@ -1317,7 +1318,7 @@ to not include another library in your asset bundle.
1317
1318
  @stable
1318
1319
  */
1319
1320
  escapeHtml = function(string) {
1320
- return string.replace(/[&<>"]/g, function(char) {
1321
+ return string.replace(/[&<>"']/g, function(char) {
1321
1322
  return ESCAPE_HTML_ENTITY_MAP[char];
1322
1323
  });
1323
1324
  };
@@ -2519,6 +2520,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
2519
2520
  [this WHATWG mailing list post](http://lists.w3.org/Archives/Public/public-whatwg-archive/2014Apr/0094.html).
2520
2521
 
2521
2522
  @function up.element.show
2523
+ @param {Element} element
2522
2524
  @experimental
2523
2525
  */
2524
2526
  show = function(element) {
@@ -2557,8 +2559,10 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
2557
2559
  @param {Element} element
2558
2560
  The element for which to add or remove the class.
2559
2561
  @param {String} className
2560
- A boolean value to determine whether the class should be added or removed.
2561
- @param {String} state
2562
+ The class which should be added or removed.
2563
+ @param {Boolean} [newPresent]
2564
+ Pass `true` to add the class to the element or `false` to remove it.
2565
+
2562
2566
  If omitted, the class will be added if missing and removed if present.
2563
2567
  @experimental
2564
2568
  */
@@ -3428,32 +3432,32 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
3428
3432
  }
3429
3433
 
3430
3434
  BodyShifter.prototype.shift = function() {
3431
- var anchor, body, bodyRightPadding, bodyRightShift, elementRight, elementRightShift, i, len, overflowElement, ref, results, scrollbarWidth;
3432
- if (!up.viewport.rootHasVerticalScrollbar()) {
3433
- return;
3434
- }
3435
- body = document.body;
3435
+ var anchor, body, bodyRightPadding, bodyRightShift, elementRight, elementRightShift, i, len, overflowElement, ref, results, rootHadVerticalScrollbar, scrollbarWidth;
3436
+ rootHadVerticalScrollbar = up.viewport.rootHasVerticalScrollbar();
3436
3437
  overflowElement = up.viewport.rootOverflowElement();
3437
- scrollbarWidth = up.viewport.scrollbarWidth();
3438
- bodyRightPadding = e.styleNumber(body, 'paddingRight');
3439
- bodyRightShift = scrollbarWidth + bodyRightPadding;
3440
- this.unshiftFns.push(e.setTemporaryStyle(body, {
3441
- paddingRight: bodyRightShift
3442
- }));
3443
3438
  this.unshiftFns.push(e.setTemporaryStyle(overflowElement, {
3444
3439
  overflowY: 'hidden'
3445
3440
  }));
3446
- ref = up.viewport.anchoredRight();
3447
- results = [];
3448
- for (i = 0, len = ref.length; i < len; i++) {
3449
- anchor = ref[i];
3450
- elementRight = e.styleNumber(anchor, 'right');
3451
- elementRightShift = scrollbarWidth + elementRight;
3452
- results.push(this.unshiftFns.push(e.setTemporaryStyle(anchor, {
3453
- right: elementRightShift
3454
- })));
3441
+ if (rootHadVerticalScrollbar) {
3442
+ body = document.body;
3443
+ scrollbarWidth = up.viewport.scrollbarWidth();
3444
+ bodyRightPadding = e.styleNumber(body, 'paddingRight');
3445
+ bodyRightShift = scrollbarWidth + bodyRightPadding;
3446
+ this.unshiftFns.push(e.setTemporaryStyle(body, {
3447
+ paddingRight: bodyRightShift
3448
+ }));
3449
+ ref = up.viewport.anchoredRight();
3450
+ results = [];
3451
+ for (i = 0, len = ref.length; i < len; i++) {
3452
+ anchor = ref[i];
3453
+ elementRight = e.styleNumber(anchor, 'right');
3454
+ elementRightShift = scrollbarWidth + elementRight;
3455
+ results.push(this.unshiftFns.push(e.setTemporaryStyle(anchor, {
3456
+ right: elementRightShift
3457
+ })));
3458
+ }
3459
+ return results;
3455
3460
  }
3456
- return results;
3457
3461
  };
3458
3462
 
3459
3463
  BodyShifter.prototype.unshift = function() {
@@ -5358,18 +5362,19 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
5358
5362
  if (u.isMissing(raw)) {
5359
5363
 
5360
5364
  } else if (raw instanceof this.constructor) {
5361
- return (ref = this.entries).push.apply(ref, raw.entries);
5365
+ (ref = this.entries).push.apply(ref, raw.entries);
5362
5366
  } else if (u.isArray(raw)) {
5363
- return (ref1 = this.entries).push.apply(ref1, raw);
5367
+ (ref1 = this.entries).push.apply(ref1, raw);
5364
5368
  } else if (u.isString(raw)) {
5365
- return this.addAllFromQuery(raw);
5369
+ this.addAllFromQuery(raw);
5366
5370
  } else if (u.isFormData(raw)) {
5367
- return this.addAllFromFormData(raw);
5371
+ this.addAllFromFormData(raw);
5368
5372
  } else if (u.isObject(raw)) {
5369
- return this.addAllFromObject(raw);
5373
+ this.addAllFromObject(raw);
5370
5374
  } else {
5371
- return up.fail("Unsupport params type: %o", raw);
5375
+ up.fail("Unsupport params type: %o", raw);
5372
5376
  }
5377
+ return this;
5373
5378
  };
5374
5379
 
5375
5380
  Params.prototype.addAllFromObject = function(object) {
@@ -5967,6 +5972,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
5967
5972
  xhrPayload = xhrParams.toFormData();
5968
5973
  }
5969
5974
  pc = up.protocol.config;
5975
+ xhrHeaders[pc.versionHeader] = up.version;
5970
5976
  if (_this.target) {
5971
5977
  xhrHeaders[pc.targetHeader] = _this.target;
5972
5978
  }
@@ -6828,14 +6834,12 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
6828
6834
  log: 'Framework booted'
6829
6835
  });
6830
6836
  isBooting = false;
6831
- return up.event.onReady(function() {
6832
- return u.task(function() {
6833
- up.emit('up:app:boot', {
6834
- log: 'Booting user application'
6835
- });
6836
- return up.emit('up:app:booted', {
6837
- log: 'User application booted'
6838
- });
6837
+ return document.addEventListener('DOMContentLoaded', function() {
6838
+ up.emit('up:app:boot', {
6839
+ log: 'Booting user application'
6840
+ });
6841
+ return up.emit('up:app:booted', {
6842
+ log: 'User application booted'
6839
6843
  });
6840
6844
  });
6841
6845
  } else {
@@ -7574,6 +7578,7 @@ an existing cookie should be deleted.
7574
7578
  Configures strings used in the optional [server protocol](/up.protocol).
7575
7579
 
7576
7580
  @property up.protocol.config
7581
+ @param {String} [config.versionHeader='X-Up-Version']
7577
7582
  @param {String} [config.targetHeader='X-Up-Target']
7578
7583
  @param {String} [config.failTargetHeader='X-Up-Fail-Target']
7579
7584
  @param {String} [config.locationHeader='X-Up-Location']
@@ -7617,6 +7622,7 @@ an existing cookie should be deleted.
7617
7622
  @experimental
7618
7623
  */
7619
7624
  config = new up.Config({
7625
+ versionHeader: 'X-Up-Version',
7620
7626
  targetHeader: 'X-Up-Target',
7621
7627
  failTargetHeader: 'X-Up-Fail-Target',
7622
7628
  locationHeader: 'X-Up-Location',
@@ -7699,12 +7705,15 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
7699
7705
  prints to the developer console.
7700
7706
  @param {string} [options.prefix='[UP] ']
7701
7707
  A string to prepend to Unpoly's logging messages so you can distinguish it from your own messages.
7708
+ @param {boolean} [options.banner=true]
7709
+ Print the Unpoly banner to the developer console.
7702
7710
  @stable
7703
7711
  */
7704
7712
  config = new up.Config({
7705
7713
  prefix: '[UP] ',
7706
7714
  enabled: sessionStore.get('enabled'),
7707
- collapse: false
7715
+ collapse: false,
7716
+ banner: true
7708
7717
  });
7709
7718
  reset = function() {
7710
7719
  return config.reset();
@@ -7890,6 +7899,9 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
7890
7899
  };
7891
7900
  printBanner = function() {
7892
7901
  var banner;
7902
+ if (!config.banner) {
7903
+ return;
7904
+ }
7893
7905
  banner = " __ _____ ___ ___ / /_ __\n" + ("/ // / _ \\/ _ \\/ _ \\/ / // / " + up.version + "\n") + "\\___/_//_/ .__/\\___/_/\\_. / \n" + " / / / /\n" + "\n";
7894
7906
  if (config.enabled) {
7895
7907
  banner += "Call `up.log.disable()` to disable logging for this session.";
@@ -7898,7 +7910,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
7898
7910
  }
7899
7911
  return console.log(banner);
7900
7912
  };
7901
- up.on('up:framework:booted', printBanner);
7913
+ up.on('up:app:boot', printBanner);
7902
7914
  up.on('up:framework:reset', reset);
7903
7915
  setEnabled = function(value) {
7904
7916
  sessionStore.set('enabled', value);
@@ -8432,15 +8444,14 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
8432
8444
  var cleanables;
8433
8445
  cleanables = e.subtree(fragment, '.up-can-clean');
8434
8446
  return u.each(cleanables, function(cleanable) {
8435
- var destructor, destructors, i, len, results;
8436
- if (destructors = cleanable.upDestructors) {
8437
- results = [];
8447
+ var destructor, destructors, i, len;
8448
+ if (destructors = u.pluckKey(cleanable, 'upDestructors')) {
8438
8449
  for (i = 0, len = destructors.length; i < len; i++) {
8439
8450
  destructor = destructors[i];
8440
- results.push(destructor());
8451
+ destructor();
8441
8452
  }
8442
- return results;
8443
8453
  }
8454
+ return cleanable.classList.remove('up-can-clean');
8444
8455
  });
8445
8456
  };
8446
8457
 
@@ -10837,7 +10848,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
10837
10848
 
10838
10849
  You can pass additional options:
10839
10850
 
10840
- up.animate('warning', '.fade-in', {
10851
+ up.animate('.warning', 'fade-in', {
10841
10852
  delay: 1000,
10842
10853
  duration: 250,
10843
10854
  easing: 'linear'
@@ -13054,6 +13065,9 @@ open dialogs with sub-forms, etc. all without losing form state.
13054
13065
  If set to `'auto'` (default), Unpoly will try to find a match in the form's layer.
13055
13066
  @param {string} [options.failLayer='auto']
13056
13067
  The name of the layer that ought to be updated if the server sends a non-200 status code.
13068
+ @param {Object|FormData|string|Array|up.Params} [options.params]
13069
+ Extra form [parameters](/up.Params) that will be submitted in addition to
13070
+ the parameters from the form.
13057
13071
  @return {Promise}
13058
13072
  A promise for the successful form submission.
13059
13073
  @stable
@@ -13103,7 +13117,7 @@ open dialogs with sub-forms, etc. all without losing form state.
13103
13117
  if (options.failLayer == null) {
13104
13118
  options.failLayer = form.getAttribute('up-fail-layer');
13105
13119
  }
13106
- options.params = up.Params.fromForm(form);
13120
+ options.params = up.Params.fromForm(form).addAll(options.params);
13107
13121
  options = u.merge(options, up.motion.animateOptions(options, form));
13108
13122
  if (options.validate) {
13109
13123
  options.headers || (options.headers = {});
@@ -13825,6 +13839,15 @@ open dialogs with sub-forms, etc. all without losing form state.
13825
13839
 
13826
13840
  <input name="query" up-observe="showSuggestions(value)">
13827
13841
 
13842
+ Note that the parameter name in the markup must be called `value` or it will not work.
13843
+ The parameter name can be called whatever you want in the JavaScript, however.
13844
+
13845
+ Also note that the function must be declared on the `window` object to work, like so:
13846
+
13847
+ window.showSuggestions = function(selectedValue) {
13848
+ console.log(`Called showSuggestions() with ${selectedValue}`);
13849
+ }
13850
+
13828
13851
  \#\#\# Callback context
13829
13852
 
13830
13853
  The script given to `[up-observe]` runs with the following context:
@@ -15032,6 +15055,9 @@ or function.
15032
15055
  if (options.failLayer == null) {
15033
15056
  options.failLayer = (ref12 = link.getAttribute('up-fail-layer')) != null ? ref12 : 'auto';
15034
15057
  }
15058
+ if (options.cache == null) {
15059
+ options.cache = e.booleanAttr(link, 'up-cache');
15060
+ }
15035
15061
  animateOptions = up.motion.animateOptions(options, link, {
15036
15062
  duration: flavorDefault('openDuration', options.flavor),
15037
15063
  easing: flavorDefault('openEasing', options.flavor)