unpoly-rails 0.32.0 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of unpoly-rails might be problematic. Click here for more details.

Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +106 -76
  3. data/README.md +8 -5
  4. data/README_RAILS.md +1 -1
  5. data/design/test_rejected_promise.txt +5 -0
  6. data/dist/unpoly-bootstrap3.js +1 -1
  7. data/dist/unpoly-bootstrap3.min.js +1 -1
  8. data/dist/unpoly.js +814 -417
  9. data/dist/unpoly.min.js +3 -3
  10. data/lib/assets/javascripts/unpoly/{browser.js.coffee → browser.coffee} +15 -6
  11. data/lib/assets/javascripts/unpoly/{bus.js.coffee → bus.coffee} +13 -13
  12. data/lib/assets/javascripts/unpoly/dom/extract_cascade.coffee +73 -0
  13. data/lib/assets/javascripts/unpoly/dom/extract_plan.coffee +65 -0
  14. data/lib/assets/javascripts/unpoly/{flow.js.coffee → dom.coffee} +109 -114
  15. data/lib/assets/javascripts/unpoly/{navigation.js.coffee → feedback.coffee} +11 -11
  16. data/lib/assets/javascripts/unpoly/{form.js.coffee → form.coffee} +35 -24
  17. data/lib/assets/javascripts/unpoly/{history.js.coffee → history.coffee} +9 -10
  18. data/lib/assets/javascripts/unpoly/{layout.js.coffee → layout.coffee} +53 -21
  19. data/lib/assets/javascripts/unpoly/{link.js.coffee → link.coffee} +46 -40
  20. data/lib/assets/javascripts/unpoly/{log.js.coffee → log.coffee} +2 -2
  21. data/lib/assets/javascripts/unpoly/{modal.js.coffee → modal.coffee} +17 -14
  22. data/lib/assets/javascripts/unpoly/{motion.js.coffee → motion.coffee} +28 -31
  23. data/lib/assets/javascripts/unpoly/namespace.coffee.erb +10 -0
  24. data/lib/assets/javascripts/unpoly/{popup.js.coffee → popup.coffee} +22 -10
  25. data/lib/assets/javascripts/unpoly/{proxy.js.coffee → proxy.coffee} +34 -12
  26. data/lib/assets/javascripts/unpoly/{rails.js.coffee → rails.coffee} +0 -0
  27. data/lib/assets/javascripts/unpoly/{syntax.js.coffee → syntax.coffee} +32 -21
  28. data/lib/assets/javascripts/unpoly/{toast.js.coffee → toast.coffee} +0 -0
  29. data/lib/assets/javascripts/unpoly/{tooltip.js.coffee → tooltip.coffee} +2 -2
  30. data/lib/assets/javascripts/unpoly/{util.js.coffee → util.coffee} +122 -35
  31. data/lib/assets/javascripts/unpoly-bootstrap3/{form-ext.js.coffee → form-ext.coffee} +0 -0
  32. data/lib/assets/javascripts/unpoly-bootstrap3/{layout-ext.js.coffee → layout-ext.coffee} +0 -0
  33. data/lib/assets/javascripts/unpoly-bootstrap3/{modal-ext.js.coffee → modal-ext.coffee} +0 -0
  34. data/lib/assets/javascripts/unpoly-bootstrap3/{navigation-ext.js.coffee → navigation-ext.coffee} +1 -1
  35. data/lib/assets/javascripts/{unpoly-bootstrap3.js.coffee → unpoly-bootstrap3.coffee} +0 -0
  36. data/lib/assets/javascripts/unpoly.coffee +22 -0
  37. data/lib/assets/stylesheets/unpoly/{close.css.sass → close.sass} +0 -0
  38. data/lib/assets/stylesheets/unpoly/{flow.css.sass → flow.sass} +0 -0
  39. data/lib/assets/stylesheets/unpoly/{link.css.sass → link.sass} +0 -0
  40. data/lib/assets/stylesheets/unpoly/{modal.css.sass → modal.sass} +0 -0
  41. data/lib/assets/stylesheets/unpoly/{popup.css.sass → popup.sass} +0 -0
  42. data/lib/assets/stylesheets/unpoly/{toast.css.sass → toast.sass} +0 -0
  43. data/lib/assets/stylesheets/unpoly/{tooltip.css.sass → tooltip.sass} +0 -0
  44. data/lib/assets/stylesheets/unpoly-bootstrap3/{modal-ext.css.sass → modal-ext.sass} +0 -0
  45. data/lib/assets/stylesheets/{unpoly-bootstrap3.css.sass → unpoly-bootstrap3.sass} +0 -0
  46. data/lib/assets/stylesheets/{unpoly.css.sass → unpoly.sass} +0 -0
  47. data/lib/unpoly/rails/version.rb +1 -1
  48. data/package.json +1 -1
  49. data/spec_app/Gemfile.lock +11 -13
  50. data/spec_app/app/assets/javascripts/jasmine_specs.coffee +1 -1
  51. data/spec_app/app/assets/stylesheets/_helpers.sass +1 -1
  52. data/spec_app/config/initializers/assets.rb +1 -5
  53. data/spec_app/spec/javascripts/up/{flow_spec.js.coffee → dom_spec.js.coffee} +294 -44
  54. data/spec_app/spec/javascripts/up/{navigation_spec.js.coffee → feedback_spec.js.coffee} +2 -2
  55. data/spec_app/spec/javascripts/up/form_spec.js.coffee +1 -0
  56. data/spec_app/spec/javascripts/up/layout_spec.js.coffee +10 -0
  57. data/spec_app/spec/javascripts/up/link_spec.js.coffee +28 -0
  58. data/spec_app/spec/javascripts/up/modal_spec.js.coffee +46 -9
  59. data/spec_app/spec/javascripts/up/motion_spec.js.coffee +32 -2
  60. data/spec_app/spec/javascripts/up/popup_spec.js.coffee +5 -4
  61. data/spec_app/spec/javascripts/up/util_spec.js.coffee +75 -0
  62. data/spec_app/vendor/{assets/bower_components/jasmine-ajax → asset-libs/jasmine-ajax-3.3.1}/.bower.json +0 -0
  63. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.gitignore +6 -0
  64. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.npmignore +10 -0
  65. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.pairs +6 -0
  66. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.travis.yml +56 -0
  67. data/spec_app/vendor/{assets/bower_components/jasmine-ajax/lib/mock-ajax.js → asset-libs/jasmine-ajax-3.3.1/jasmine-ajax.js} +83 -26
  68. data/spec_app/vendor/{assets/bower_components/jasmine-fixture/dist → asset-libs/jasmine-fixture-1.3.4}/jasmine-fixture.js +13 -13
  69. data/spec_app/vendor/{assets/bower_components/jasmine-jquery → asset-libs/jasmine-jquery-2.1.1}/.bower.json +0 -0
  70. data/spec_app/vendor/{assets/bower_components/jasmine-jquery/lib → asset-libs/jasmine-jquery-2.1.1}/jasmine-jquery.js +0 -0
  71. data/spec_app/vendor/assets/{javascripts/.keep → .keep} +0 -0
  72. metadata +52 -203
  73. data/lib/assets/javascripts/unpoly/module.js.coffee.erb +0 -8
  74. data/lib/assets/javascripts/unpoly.js.coffee +0 -21
  75. data/spec_app/Bowerfile +0 -3
  76. data/spec_app/vendor/assets/.bowerrc +0 -3
  77. data/spec_app/vendor/assets/bower.json +0 -8
  78. data/spec_app/vendor/assets/bower_components/jasmine/.bower.json +0 -50
  79. data/spec_app/vendor/assets/bower_components/jasmine/CONTRIBUTING.md +0 -130
  80. data/spec_app/vendor/assets/bower_components/jasmine/GOALS_2.0.md +0 -64
  81. data/spec_app/vendor/assets/bower_components/jasmine/MANIFEST.in +0 -5
  82. data/spec_app/vendor/assets/bower_components/jasmine/MIT.LICENSE +0 -20
  83. data/spec_app/vendor/assets/bower_components/jasmine/README.md +0 -73
  84. data/spec_app/vendor/assets/bower_components/jasmine/RELEASE.md +0 -73
  85. data/spec_app/vendor/assets/bower_components/jasmine/bower.json +0 -41
  86. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine-horizontal.png +0 -0
  87. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine-horizontal.svg +0 -102
  88. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine_favicon.png +0 -0
  89. data/spec_app/vendor/assets/bower_components/jasmine/lib/console/console.js +0 -190
  90. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot.js +0 -143
  91. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/lib/jasmine_examples/Player.js +0 -24
  92. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/lib/jasmine_examples/Song.js +0 -9
  93. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine-html.js +0 -446
  94. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.css +0 -58
  95. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.js +0 -3298
  96. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/json2.js +0 -489
  97. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/node_boot.js +0 -41
  98. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core.js +0 -37
  99. data/spec_app/vendor/assets/bower_components/jasmine/package.json +0 -34
  100. data/spec_app/vendor/assets/bower_components/jasmine/requirements.txt +0 -1
  101. data/spec_app/vendor/assets/bower_components/jasmine-ajax/MIT.LICENSE +0 -20
  102. data/spec_app/vendor/assets/bower_components/jasmine-ajax/README.markdown +0 -289
  103. data/spec_app/vendor/assets/bower_components/jasmine-ajax/bower.json +0 -35
  104. data/spec_app/vendor/assets/bower_components/jasmine-ajax/package.json +0 -26
  105. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.0.2.md +0 -50
  106. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.99.md +0 -14
  107. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.0.md +0 -28
  108. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.0.md +0 -24
  109. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.1.md +0 -23
  110. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.2.0.md +0 -20
  111. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.bower.json +0 -27
  112. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.gitignore +0 -8
  113. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.npmignore +0 -8
  114. data/spec_app/vendor/assets/bower_components/jasmine-fixture/LICENSE.txt +0 -24
  115. data/spec_app/vendor/assets/bower_components/jasmine-fixture/README.md +0 -118
  116. data/spec_app/vendor/assets/bower_components/jasmine-fixture/bower.json +0 -17
  117. data/spec_app/vendor/assets/bower_components/jasmine-fixture/dist/jasmine-fixture.min.js +0 -5
  118. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/basic-usage-spec.coffee +0 -14
  119. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/invariants.coffee +0 -17
  120. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/spec-within-a-spec.coffee +0 -24
  121. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/tmp-files.coffee +0 -8
  122. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/support/jasmine1-testem-config.json +0 -11
  123. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/support/jasmine2-testem-config.json +0 -11
  124. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-1.11.0.js +0 -10337
  125. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-1.8.3.js +0 -9472
  126. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-2.1.0.js +0 -9111
  127. data/spec_app/vendor/assets/bower_components/jasmine-jquery/CONTRIBUTING.md +0 -28
  128. data/spec_app/vendor/assets/bower_components/jasmine-jquery/Gruntfile.js +0 -49
  129. data/spec_app/vendor/assets/bower_components/jasmine-jquery/LICENSE +0 -20
  130. data/spec_app/vendor/assets/bower_components/jasmine-jquery/README.md +0 -367
  131. data/spec_app/vendor/assets/bower_components/jasmine-jquery/bower.json +0 -15
  132. data/spec_app/vendor/assets/bower_components/jasmine-jquery/package.json +0 -35
  133. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_checkbox_with_checked.html +0 -6
  134. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_javascript.html +0 -1
  135. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_javascript_block.html +0 -1
  136. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/javascripts/jasmine_javascript_click.js +0 -1
  137. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/javascripts/jasmine_javascript_hover.js +0 -1
  138. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/json/jasmine_json_test.json +0 -1
  139. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/real_non_mocked_fixture.html +0 -1
  140. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/real_non_mocked_fixture_style.css +0 -1
  141. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/suites/jasmine-jquery-spec.js +0 -1842
  142. data/spec_app/vendor/assets/bower_components/jquery/.bower.json +0 -38
  143. data/spec_app/vendor/assets/bower_components/jquery/MIT-LICENSE.txt +0 -21
  144. data/spec_app/vendor/assets/bower_components/jquery/bower.json +0 -28
  145. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.js +0 -9210
  146. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.js +0 -5
  147. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.map +0 -1
  148. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/jsonp.js +0 -89
  149. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/load.js +0 -75
  150. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/parseJSON.js +0 -13
  151. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/parseXML.js +0 -28
  152. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/script.js +0 -64
  153. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/var/nonce.js +0 -5
  154. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/var/rquery.js +0 -3
  155. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/xhr.js +0 -136
  156. data/spec_app/vendor/assets/bower_components/jquery/src/ajax.js +0 -786
  157. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/attr.js +0 -141
  158. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/classes.js +0 -158
  159. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/prop.js +0 -94
  160. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/support.js +0 -35
  161. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/val.js +0 -161
  162. data/spec_app/vendor/assets/bower_components/jquery/src/attributes.js +0 -11
  163. data/spec_app/vendor/assets/bower_components/jquery/src/callbacks.js +0 -205
  164. data/spec_app/vendor/assets/bower_components/jquery/src/core/access.js +0 -60
  165. data/spec_app/vendor/assets/bower_components/jquery/src/core/init.js +0 -123
  166. data/spec_app/vendor/assets/bower_components/jquery/src/core/parseHTML.js +0 -39
  167. data/spec_app/vendor/assets/bower_components/jquery/src/core/ready.js +0 -97
  168. data/spec_app/vendor/assets/bower_components/jquery/src/core/var/rsingleTag.js +0 -4
  169. data/spec_app/vendor/assets/bower_components/jquery/src/core.js +0 -502
  170. data/spec_app/vendor/assets/bower_components/jquery/src/css/addGetHookIf.js +0 -22
  171. data/spec_app/vendor/assets/bower_components/jquery/src/css/curCSS.js +0 -57
  172. data/spec_app/vendor/assets/bower_components/jquery/src/css/defaultDisplay.js +0 -70
  173. data/spec_app/vendor/assets/bower_components/jquery/src/css/hiddenVisibleSelectors.js +0 -15
  174. data/spec_app/vendor/assets/bower_components/jquery/src/css/support.js +0 -96
  175. data/spec_app/vendor/assets/bower_components/jquery/src/css/swap.js +0 -28
  176. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/cssExpand.js +0 -3
  177. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/getStyles.js +0 -12
  178. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/isHidden.js +0 -13
  179. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/rmargin.js +0 -3
  180. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/rnumnonpx.js +0 -5
  181. data/spec_app/vendor/assets/bower_components/jquery/src/css.js +0 -450
  182. data/spec_app/vendor/assets/bower_components/jquery/src/data/Data.js +0 -181
  183. data/spec_app/vendor/assets/bower_components/jquery/src/data/accepts.js +0 -20
  184. data/spec_app/vendor/assets/bower_components/jquery/src/data/var/data_priv.js +0 -5
  185. data/spec_app/vendor/assets/bower_components/jquery/src/data/var/data_user.js +0 -5
  186. data/spec_app/vendor/assets/bower_components/jquery/src/data.js +0 -178
  187. data/spec_app/vendor/assets/bower_components/jquery/src/deferred.js +0 -149
  188. data/spec_app/vendor/assets/bower_components/jquery/src/deprecated.js +0 -13
  189. data/spec_app/vendor/assets/bower_components/jquery/src/dimensions.js +0 -50
  190. data/spec_app/vendor/assets/bower_components/jquery/src/effects/Tween.js +0 -114
  191. data/spec_app/vendor/assets/bower_components/jquery/src/effects/animatedSelector.js +0 -13
  192. data/spec_app/vendor/assets/bower_components/jquery/src/effects.js +0 -648
  193. data/spec_app/vendor/assets/bower_components/jquery/src/event/ajax.js +0 -13
  194. data/spec_app/vendor/assets/bower_components/jquery/src/event/alias.js +0 -39
  195. data/spec_app/vendor/assets/bower_components/jquery/src/event/support.js +0 -9
  196. data/spec_app/vendor/assets/bower_components/jquery/src/event.js +0 -868
  197. data/spec_app/vendor/assets/bower_components/jquery/src/exports/amd.js +0 -24
  198. data/spec_app/vendor/assets/bower_components/jquery/src/exports/global.js +0 -32
  199. data/spec_app/vendor/assets/bower_components/jquery/src/intro.js +0 -44
  200. data/spec_app/vendor/assets/bower_components/jquery/src/jquery.js +0 -37
  201. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/_evalUrl.js +0 -18
  202. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/support.js +0 -32
  203. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/var/rcheckableType.js +0 -3
  204. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation.js +0 -580
  205. data/spec_app/vendor/assets/bower_components/jquery/src/offset.js +0 -207
  206. data/spec_app/vendor/assets/bower_components/jquery/src/outro.js +0 -1
  207. data/spec_app/vendor/assets/bower_components/jquery/src/queue/delay.js +0 -22
  208. data/spec_app/vendor/assets/bower_components/jquery/src/queue.js +0 -142
  209. data/spec_app/vendor/assets/bower_components/jquery/src/selector-native.js +0 -172
  210. data/spec_app/vendor/assets/bower_components/jquery/src/selector-sizzle.js +0 -14
  211. data/spec_app/vendor/assets/bower_components/jquery/src/selector.js +0 -1
  212. data/spec_app/vendor/assets/bower_components/jquery/src/serialize.js +0 -111
  213. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.js +0 -2067
  214. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
  215. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
  216. data/spec_app/vendor/assets/bower_components/jquery/src/traversing/findFilter.js +0 -100
  217. data/spec_app/vendor/assets/bower_components/jquery/src/traversing/var/rneedsContext.js +0 -6
  218. data/spec_app/vendor/assets/bower_components/jquery/src/traversing.js +0 -199
  219. data/spec_app/vendor/assets/bower_components/jquery/src/var/arr.js +0 -3
  220. data/spec_app/vendor/assets/bower_components/jquery/src/var/class2type.js +0 -4
  221. data/spec_app/vendor/assets/bower_components/jquery/src/var/concat.js +0 -5
  222. data/spec_app/vendor/assets/bower_components/jquery/src/var/hasOwn.js +0 -5
  223. data/spec_app/vendor/assets/bower_components/jquery/src/var/indexOf.js +0 -5
  224. data/spec_app/vendor/assets/bower_components/jquery/src/var/pnum.js +0 -3
  225. data/spec_app/vendor/assets/bower_components/jquery/src/var/push.js +0 -5
  226. data/spec_app/vendor/assets/bower_components/jquery/src/var/rnotwhite.js +0 -3
  227. data/spec_app/vendor/assets/bower_components/jquery/src/var/slice.js +0 -5
  228. data/spec_app/vendor/assets/bower_components/jquery/src/var/strundefined.js +0 -3
  229. data/spec_app/vendor/assets/bower_components/jquery/src/var/support.js +0 -4
  230. data/spec_app/vendor/assets/bower_components/jquery/src/var/toString.js +0 -5
  231. data/spec_app/vendor/assets/bower_components/jquery/src/wrap.js +0 -79
  232. data/spec_app/vendor/assets/stylesheets/.keep +0 -0
@@ -17,7 +17,7 @@ up.form = (($) ->
17
17
 
18
18
  @property up.form.config
19
19
  @param {Number} [config.observeDelay=0]
20
- The number of miliseconds to wait before [`up.observe`](/up.observe) runs the callback
20
+ The number of miliseconds to wait before [`up.observe()`](/up.observe) runs the callback
21
21
  after the input value changes. Use this to limit how often the callback
22
22
  will be invoked for a fast typist.
23
23
  @param {Array} [config.validateTargets=['[up-fieldset]:has(&)', 'fieldset:has(&)', 'label:has(&)', 'form:has(&)']]
@@ -67,11 +67,14 @@ up.form = (($) ->
67
67
  if none of these attributes are given.
68
68
  @param {String} [options.target]
69
69
  The selector to update when the form submission succeeds (server responds with status 200).
70
- Defaults to the form's `up-target` attribute, or to `'body'`.
70
+ Defaults to the form's `up-target` attribute.
71
71
  @param {String} [options.failTarget]
72
72
  The selector to update when the form submission fails (server responds with non-200 status).
73
73
  Defaults to the form's `up-fail-target` attribute, or to an auto-generated
74
74
  selector that matches the form itself.
75
+ @param {String} [options.fallback]
76
+ The selector to update when the original target was not found in the page.
77
+ Defaults to the form's `up-fallback` attribute.
75
78
  @param {Boolean|String} [options.history=true]
76
79
  Successful form submissions will add a history entry and change the browser's
77
80
  location bar if the form either uses the `GET` method or the response redirected
@@ -85,11 +88,11 @@ up.form = (($) ->
85
88
  The transition to use when a failed form submission updates the `options.failTarget` selector.
86
89
  Defaults to the form's `up-fail-transition` attribute, or to `options.transition`, or to `'none'`.
87
90
  @param {Number} [options.duration]
88
- The duration of the transition. See [`up.morph`](/up.morph).
91
+ The duration of the transition. See [`up.morph()`](/up.morph).
89
92
  @param {Number} [options.delay]
90
- The delay before the transition starts. See [`up.morph`](/up.morph).
93
+ The delay before the transition starts. See [`up.morph()`](/up.morph).
91
94
  @param {String} [options.easing]
92
- The timing function that controls the transition's acceleration. [`up.morph`](/up.morph).
95
+ The timing function that controls the transition's acceleration. [`up.morph()`](/up.morph).
93
96
  @param {Element|jQuery|String} [options.reveal]
94
97
  Whether to reveal the target element within its viewport.
95
98
  @param {Boolean} [options.restoreScroll]
@@ -117,6 +120,7 @@ up.form = (($) ->
117
120
  target = u.option(options.target, $form.attr('up-target'), 'body')
118
121
  url = u.option(options.url, $form.attr('action'), up.browser.url())
119
122
  options.failTarget = u.option(options.failTarget, $form.attr('up-fail-target')) || u.selectorForElement($form)
123
+ options.fallback = u.option(options.fallback, $form.attr('up-fallback'))
120
124
  options.history = u.option(options.history, u.castedAttr($form, 'up-history'), true)
121
125
  options.transition = u.option(options.transition, u.castedAttr($form, 'up-transition'), 'none')
122
126
  options.failTransition = u.option(options.failTransition, u.castedAttr($form, 'up-fail-transition'), 'none')
@@ -144,7 +148,7 @@ up.form = (($) ->
144
148
  unless canAjaxSubmit
145
149
  return u.unresolvablePromise()
146
150
 
147
- up.navigation.start($form)
151
+ up.feedback.start($form)
148
152
 
149
153
  # If we can't submit this form via AJAX or if we wouldn't be able to change
150
154
  # the location URL as the result, fall back to a vanilla form submission.
@@ -153,7 +157,7 @@ up.form = (($) ->
153
157
  return u.unresolvablePromise()
154
158
 
155
159
  promise = up.replace(target, url, options)
156
- promise.always -> up.navigation.stop($form)
160
+ promise.always -> up.feedback.stop($form)
157
161
  return promise
158
162
 
159
163
  ###*
@@ -179,10 +183,10 @@ up.form = (($) ->
179
183
 
180
184
  Making network requests whenever a form field changes can cause
181
185
  [concurrency issues](https://makandracards.com/makandra/961-concurrency-issues-with-find-as-you-type-boxes).
182
- Since `up.observe` can trigger many requests in a short period of time,
186
+ Since `up.observe()` can trigger many requests in a short period of time,
183
187
  the responses might not arrive in the same order.
184
188
 
185
- To mitigate this, `up.observe` will try to never run a callback
189
+ To mitigate this, `up.observe()` will try to never run a callback
186
190
  before the previous callback has completed.
187
191
  For this your callback code must return a promise that resolves
188
192
  when your request completes.
@@ -195,8 +199,8 @@ up.form = (($) ->
195
199
  return submitDone;
196
200
  });
197
201
 
198
- Note that many Unpoly functions like [`up.submit`](/up.submit) or
199
- [`up.replace`](/up.replace) return promises.
202
+ Note that many Unpoly functions like [`up.submit()`](/up.submit) or
203
+ [`up.replace()`](/up.replace) return promises.
200
204
 
201
205
  \#\#\# Debouncing
202
206
 
@@ -242,6 +246,8 @@ up.form = (($) ->
242
246
  callback = null
243
247
  rawCallback = u.option(callbackArg, u.presentAttr($fields, 'up-observe'))
244
248
  if u.isString(rawCallback)
249
+ console.debug("**** RAW CALLBACK IS %o", rawCallback)
250
+ # rawCallback = 'true'
245
251
  callback = (value, $field) -> eval(rawCallback)
246
252
  else
247
253
  callback = rawCallback or up.fail('up.observe: No change callback given')
@@ -305,7 +311,7 @@ up.form = (($) ->
305
311
  @param {String|Element|jQuery} selectorOrElement
306
312
  The field or form to observe.
307
313
  @param {Object} [options]
308
- See options for [`up.observe`](/up.observe)
314
+ See options for [`up.observe()`](/up.observe)
309
315
  @return {Function}
310
316
  A destructor function that removes the observe watch when called.
311
317
  @stable
@@ -313,14 +319,14 @@ up.form = (($) ->
313
319
  autosubmit = (selectorOrElement, options) ->
314
320
  observe(selectorOrElement, options, (value, $field) ->
315
321
  $form = $field.closest('form')
316
- up.navigation.start $field, -> submit($form)
322
+ up.feedback.start $field, -> submit($form)
317
323
  )
318
324
 
319
325
  resolveValidateTarget = ($field, options) ->
320
326
  target = u.option(options.target, $field.attr('up-validate'))
321
327
  if u.isBlank(target)
322
328
  target ||= u.detect(config.validateTargets, (defaultTarget) ->
323
- resolvedDefault = up.flow.resolveSelector(defaultTarget, options.origin)
329
+ resolvedDefault = up.dom.resolveSelector(defaultTarget, options.origin)
324
330
  $field.closest(resolvedDefault).length
325
331
  )
326
332
  if u.isBlank(target)
@@ -333,7 +339,7 @@ up.form = (($) ->
333
339
  Performs a server-side validation of a form and update the form
334
340
  with validation messages.
335
341
 
336
- `up.validate` submits the given field's form with an additional `X-Up-Validate`
342
+ `up.validate()` submits the given field's form with an additional `X-Up-Validate`
337
343
  HTTP header. Upon seeing this header, the server is expected to validate (but not save)
338
344
  the form submission and render a new copy of the form with validation errors.
339
345
 
@@ -465,7 +471,7 @@ up.form = (($) ->
465
471
  The server response is searched for the selector given in `up-target`.
466
472
  The selector content is then [replaced](/up.replace) in the current page.
467
473
 
468
- The programmatic variant of this is the [`up.submit`](/up.submit) function.
474
+ The programmatic variant of this is the [`up.submit()`](/up.submit) function.
469
475
 
470
476
  \#\#\# Failed submission
471
477
 
@@ -528,6 +534,8 @@ up.form = (($) ->
528
534
  The selector to [replace](/up.replace) if the form submission is not successful (non-200 status code).
529
535
  If omitted, Unpoly will replace the `<form>` tag itself, assuming that the
530
536
  server has echoed the form with validation errors.
537
+ @param [up-fallback]
538
+ The selector to replace if the server responds with a non-200 status code.
531
539
  @param {String} [up-transition]
532
540
  The animation to use when the form is replaced after a successful submission.
533
541
  @param {String} [up-fail-transition]
@@ -563,11 +571,14 @@ up.form = (($) ->
563
571
  submit($form)
564
572
 
565
573
  ###*
566
- When a form field with this attribute is changed,
567
- the form is validated on the server and is updated with
568
- validation messages.
574
+ When a form field with this attribute is changed, the form is validated on the server
575
+ and is updated with validation messages.
576
+
577
+ To validate the form, Unpoly will submit the form with an additional `X-Up-Validate` HTTP header.
578
+ When seeing this header, the server is expected to validate (but not save)
579
+ the form submission and render a new copy of the form with validation errors.
569
580
 
570
- The programmatic variant of this is the [`up.validate`](/up.validate) function.
581
+ The programmatic variant of this is the [`up.validate()`](/up.validate) function.
571
582
 
572
583
  \#\#\# Example
573
584
 
@@ -608,7 +619,7 @@ up.form = (($) ->
608
619
 
609
620
  Whenever a field with `up-validate` changes, the form is POSTed to
610
621
  `/users` with an additional `X-Up-Validate` HTTP header.
611
- Upon seeing this header, the server is expected to validate (but not save)
622
+ When seeing this header, the server is expected to validate (but not save)
612
623
  the form submission and render a new copy of the form with validation errors.
613
624
 
614
625
  In Ruby on Rails the processing action should behave like this:
@@ -663,7 +674,7 @@ up.form = (($) ->
663
674
  With the Bootstrap bindings, Unpoly will also look
664
675
  for a container with the `form-group` class.
665
676
 
666
- You can change this default behavior by setting `up.config.validateTargets`:
677
+ You can change this default behavior by setting [`up.form.config.validateTargets`](/up.form.config#validateTargets):
667
678
 
668
679
  // Always update the entire form containing the current field ("&")
669
680
  up.form.config.validateTargets = ['form &']
@@ -788,7 +799,7 @@ up.form = (($) ->
788
799
 
789
800
  This is useful for observing text fields while the user is typing.
790
801
 
791
- The programmatic variant of this is the [`up.observe`](/up.observe) function.
802
+ The programmatic variant of this is the [`up.observe()`](/up.observe) function.
792
803
 
793
804
  \#\#\# Example
794
805
 
@@ -824,7 +835,7 @@ up.form = (($) ->
824
835
  The form field will be assigned a CSS class [`up-active`](/up-active)
825
836
  while the autosubmitted form is processing.
826
837
 
827
- The programmatic variant of this is the [`up.autosubmit`](/up.autosubmit) function.
838
+ The programmatic variant of this is the [`up.autosubmit()`](/up.autosubmit) function.
828
839
 
829
840
  \#\#\# Example
830
841
 
@@ -34,8 +34,8 @@ up.history = (($) ->
34
34
  Returns the previous URL in the browser history.
35
35
 
36
36
  Note that this will only work reliably for history changes that
37
- were applied by [`up.history.push`](/up.history.replace) or
38
- [`up.history.replace`](/up.history.replace).
37
+ were applied by [`up.history.push()`](/up.history.replace) or
38
+ [`up.history.replace()`](/up.history.replace).
39
39
 
40
40
  @function up.history.previousUrl
41
41
  @internal
@@ -77,8 +77,8 @@ up.history = (($) ->
77
77
  Unpoly will [`replace`](/up.replace) the document body with
78
78
  the body from that URL.
79
79
 
80
- Note that functions like [`up.replace`](/up.replace) or
81
- [`up.submit`](/up.submit) will automatically update the
80
+ Note that functions like [`up.replace()`](/up.replace) or
81
+ [`up.submit()`](/up.submit) will automatically update the
82
82
  browser's location bar for you.
83
83
 
84
84
  @function up.history.replace
@@ -96,8 +96,8 @@ up.history = (($) ->
96
96
  Unpoly will [`replace`](/up.replace) the document body with
97
97
  the body from that URL.
98
98
 
99
- Note that functions like [`up.replace`](/up.replace) or
100
- [`up.submit`](/up.submit) will automatically update the
99
+ Note that functions like [`up.replace()`](/up.replace) or
100
+ [`up.submit()`](/up.submit) will automatically update the
101
101
  browser's location bar for you.
102
102
 
103
103
  Emits events [`up:history:push`](/up:history:push) and [`up:history:pushed`](/up:history:pushed).
@@ -151,11 +151,11 @@ up.history = (($) ->
151
151
  up.log.group "Restoring URL %s", url, ->
152
152
  popSelector = config.popTargets.join(', ')
153
153
  up.replace popSelector, url,
154
- history: false,
155
- title: true,
154
+ history: false, # don't push a new state
155
+ title: true, # do extract the title from the response
156
156
  reveal: false,
157
157
  transition: 'none',
158
- saveScroll: false # since the URL was already changed by the browser, don't save scroll state
158
+ saveScroll: false # since the URL was already changed by the browser, don't save scroll state
159
159
  restoreScroll: config.restoreScroll
160
160
  else
161
161
  up.puts 'Ignoring a state not pushed by Unpoly (%o)', state
@@ -227,7 +227,6 @@ up.history = (($) ->
227
227
  up.on 'up:framework:reset', reset
228
228
 
229
229
  config: config
230
- defaults: -> up.fail('up.history.defaults(...) no longer exists. Set values on he up.history.config property instead.')
231
230
  push: push
232
231
  replace: replace
233
232
  url: currentUrl
@@ -32,12 +32,15 @@ up.layout = (($) ->
32
32
  @param {Array} [config.fixedTop]
33
33
  An array of CSS selectors that find elements fixed to the
34
34
  top edge of the screen (using `position: fixed`).
35
+ See [`[up-fixed="top"]`](/up-fixed-top) for details.
35
36
  @param {Array} [config.fixedBottom]
36
37
  An array of CSS selectors that find elements fixed to the
37
38
  bottom edge of the screen (using `position: fixed`).
39
+ See [`[up-fixed="bottom"]`](/up-fixed-bottom) for details.
38
40
  @param {Array} [config.anchoredRight]
39
41
  An array of CSS selectors that find elements anchored to the
40
- right edge of the screen (using `position: fixed` or `position: absolute`).
42
+ right edge of the screen (using `right:0` with `position: fixed` or `position: absolute`).
43
+ See [`[up-anchored="right"]`](/up-anchored-right) for details.
41
44
  @param {Number} [config.duration=0]
42
45
  The duration of the scrolling animation in milliseconds.
43
46
  Setting this to `0` will disable scrolling animations.
@@ -93,7 +96,7 @@ up.layout = (($) ->
93
96
  duration: 250
94
97
  });
95
98
 
96
- If the given viewport is already in a scroll animation when `up.scroll`
99
+ If the given viewport is already in a scroll animation when `up.scroll()`
97
100
  is called a second time, the previous animation will instantly jump to the
98
101
  last frame before the next animation is started.
99
102
 
@@ -170,11 +173,11 @@ up.layout = (($) ->
170
173
  anchorPosition = $obstructor.css(cssAttr)
171
174
  unless u.isPresent(anchorPosition)
172
175
  up.fail("Fixed element %o must have a CSS attribute %s", $obstructor.get(0), cssAttr)
173
- parseInt(anchorPosition) + $obstructor.height()
176
+ parseFloat(anchorPosition) + $obstructor.height()
174
177
 
175
178
  fixedTopBottoms = for obstructor in $(config.fixedTop.join(', '))
176
179
  measurePosition(obstructor, 'top')
177
-
180
+
178
181
  fixedBottomTops = for obstructor in $(config.fixedBottom.join(', '))
179
182
  measurePosition(obstructor, 'bottom')
180
183
 
@@ -186,7 +189,7 @@ up.layout = (($) ->
186
189
  element are visible for the user.
187
190
 
188
191
  By default Unpoly will always reveal an element before
189
- updating it with JavaScript functions like [`up.replace`](/up.replace)
192
+ updating it with JavaScript functions like [`up.replace()`](/up.replace)
190
193
  or UJS behavior like [`[up-target]`](/a-up-target).
191
194
 
192
195
  \#\#\# How Unpoly finds the viewport
@@ -204,9 +207,9 @@ up.layout = (($) ->
204
207
  Many applications have a navigation bar fixed to the top or bottom,
205
208
  obstructing the view on an element.
206
209
 
207
- You can make `up.reveal` aware of these fixed elements
210
+ You can make `up.reveal()` aware of these fixed elements
208
211
  so it can scroll the viewport far enough so the revealed element is fully visible.
209
- To make `up.reveal` aware fixed elements you can either:
212
+ To make `up.reveal()` aware fixed elements you can either:
210
213
 
211
214
  - give the element an attribute [`up-fixed="top"`](/up-fixed-top) or [`up-fixed="bottom"`](up-fixed-bottom)
212
215
  - [configure default options](/up.layout.config) for `fixedTop` or `fixedBottom`
@@ -258,7 +261,7 @@ up.layout = (($) ->
258
261
  predictFirstVisibleRow = -> newScrollPos + obstruction.top
259
262
  predictLastVisibleRow = -> newScrollPos + viewportHeight - obstruction.bottom - 1
260
263
 
261
- elementDims = u.measure($element, relative: $viewport)
264
+ elementDims = u.measure($element, relative: $viewport, includeMargin: true)
262
265
  firstElementRow = elementDims.top + offsetShift
263
266
  lastElementRow = firstElementRow + Math.min(elementDims.height, config.substance) - 1
264
267
 
@@ -445,7 +448,7 @@ up.layout = (($) ->
445
448
  instead of scrolling `<body>`. As an alternative you can also push a selector
446
449
  matching your custom viewport to the [`up.layout.config.viewports`](/up.layout.config) array.
447
450
 
448
- [`up.reveal`](/up.reveal) will always try to scroll the viewport closest
451
+ [`up.reveal()`](/up.reveal) will always try to scroll the viewport closest
449
452
  to the element that is being revealed. By default this is the `<body>` element.
450
453
 
451
454
  \#\#\# Example
@@ -492,11 +495,16 @@ up.layout = (($) ->
492
495
  ###
493
496
 
494
497
  ###*
495
- Marks this element as a navigation fixed to the top edge of the screen
498
+ Marks this element as being fixed to the top edge of the screen
496
499
  using `position: fixed`.
497
500
 
498
- [`up.reveal`](/up.reveal) is aware of fixed elements and will scroll
499
- the viewport far enough so the revealed element is fully visible.
501
+ When [following a fragment link](/a-up-target), the viewport is scrolled
502
+ so the targeted element becomes visible. By using this attribute you can make
503
+ Unpoly aware of fixed elements that are obstructing the viewport contents.
504
+ Unpoly will then scroll the viewport far enough that the revealed element is fully visible.
505
+
506
+ Instead of using this attribute,
507
+ you can also configure a selector in [`up.layout.config.fixedTop`](/up.layout.config#fixedTop).
500
508
 
501
509
  \#\#\# Example
502
510
 
@@ -507,11 +515,16 @@ up.layout = (($) ->
507
515
  ###
508
516
 
509
517
  ###*
510
- Marks this element as a navigation fixed to the bottom edge of the screen
518
+ Marks this element as being fixed to the bottom edge of the screen
511
519
  using `position: fixed`.
512
520
 
513
- [`up.reveal`](/up.reveal) is aware of fixed elements and will scroll
514
- the viewport far enough so the revealed element is fully visible.
521
+ When [following a fragment link](/a-up-target), the viewport is scrolled
522
+ so the targeted element becomes visible. By using this attribute you can make
523
+ Unpoly aware of fixed elements that are obstructing the viewport contents.
524
+ Unpoly will then scroll the viewport far enough that the revealed element is fully visible.
525
+
526
+ Instead of using this attribute,
527
+ you can also configure a selector in [`up.layout.config.fixedBottom`](/up.layout.config#fixedBottom).
515
528
 
516
529
  \#\#\# Example
517
530
 
@@ -523,15 +536,35 @@ up.layout = (($) ->
523
536
 
524
537
 
525
538
  ###*
526
- Marks this element as a navigation anchored to the right edge of the screen
527
- using `position: fixed` or `position:absolute`.
539
+ Marks this element as being anchored to the right edge of the screen,
540
+ typically fixed navigation bars.
541
+
542
+ Since [modal dialogs](/up.modal) hide the document scroll bar,
543
+ elements anchored to the right appear to jump when the dialog opens or
544
+ closes. Applying this attribute to anchored elements will make Unpoly
545
+ aware of the issue and adjust the `right` property accordingly.
546
+
547
+ You should give this attribute to layout elements
548
+ with a CSS of `right: 0` with `position: fixed` or `position:absolute`.
528
549
 
529
- [`up.modal`](/up.modal) will move anchored elements to the left so they
530
- don't appear to move when a modal dialog is opened or closed.
550
+ Instead of giving this attribute to any affected element,
551
+ you can also configure a selector in [`up.layout.config.anchoredRight`](/up.layout.config#anchoredRight).
531
552
 
532
553
  \#\#\# Example
533
554
 
534
- <div class="bottom-nav" up-fixed="bottom">...</div>
555
+ Here is the CSS for a navigation bar that is anchored to the top edge of the screen:
556
+
557
+ .top-nav {
558
+ position: fixed;
559
+ top: 0;
560
+ left: 0;
561
+ right: 0;
562
+ }
563
+
564
+ By adding an `up-anchored="right"` attribute to the element, we can prevent the
565
+ `right` edge from jumping when a [modal dialog](/up.modal) opens or closes:
566
+
567
+ <div class="top-nav" up-anchored="right">...</div>
535
568
 
536
569
  @selector [up-anchored=right]
537
570
  @stable
@@ -544,7 +577,6 @@ up.layout = (($) ->
544
577
  scroll: scroll
545
578
  finishScrolling: finishScrolling
546
579
  config: config
547
- defaults: -> up.fail('up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.')
548
580
  viewportOf: viewportOf
549
581
  viewportsWithin: viewportsWithin
550
582
  viewports: viewports
@@ -1,8 +1,13 @@
1
1
  ###*
2
- Linking to page fragments
3
- =========================
2
+ Linking to fragments
3
+ ====================
4
4
 
5
- Standard HTML links are a poor fit for modern applications:
5
+ In a traditional web application, the entire page is destroyed and re-created when the
6
+ user follows a link:
7
+
8
+ ![Traditional page flow](/images/tutorial/fragment_flow_vanilla.svg){:width="620px" class="picture has_border is_sepia has_padding"}
9
+
10
+ This makes for an unfriendly experience:
6
11
 
7
12
  - State changes caused by AJAX updates get lost during the page transition.
8
13
  - Unsaved form changes get lost during the page transition.
@@ -12,27 +17,21 @@ Standard HTML links are a poor fit for modern applications:
12
17
  - The user sees a "flash" as the browser loads and renders the new page,
13
18
  even if large portions of the old and new page are the same (navigation, layout, etc.).
14
19
 
15
- Unpoly fixes this by letting you annotate links with an [`up-target`](/a-up-target)
20
+ Unpoly fixes this by letting you annotate links with an [`up-target`](/a-up-target)
16
21
  attribute. The value of this attribute is a CSS selector that indicates which page
17
- fragment to update. The rest of the page will remain unchanged.
22
+ fragment to update. The server **still renders full HTML pages**, but we only use
23
+ the targeted ragments and discard the rest:
18
24
 
25
+ ![Unpoly page flow](/images/tutorial/fragment_flow_unpoly.svg){:width="620px" class="picture has_border is_sepia has_padding"}
19
26
 
20
- \#\#\# Example
27
+ With this model, following links feel smooth. All transient DOM changes outside the updated fragment are preserved.
28
+ Pages also load much faster since the DOM, CSS and Javascript environments do not need to be
29
+ destroyed and recreated for every request.
21
30
 
22
- Let's say we are rendering three pages with a tabbed navigation to switch between screens:
23
31
 
32
+ ## Example
24
33
 
25
- ```
26
- /pages/a /pages/b /pages/c
27
-
28
- +---+---+---+ +---+---+---+ +---+---+---+
29
- | A | B | C | | A | B | C | | A | B | C |
30
- | +-------- (click) +---+ +---- (click) +---+---+ |
31
- | | ======> | | ======> | |
32
- | Page A | | Page B | | Page C |
33
- | | | | | |
34
- +-----------| +-----------| +-----------|
35
- ```
34
+ Let's say we are rendering three pages with a tabbed navigation to switch between screens:
36
35
 
37
36
  Your HTML could look like this:
38
37
 
@@ -65,18 +64,6 @@ With these [`up-target`](/a-up-target) annotations Unpoly only updates the targe
65
64
  The JavaScript environment will persist and the user will not see a white flash while the
66
65
  new page is loading.
67
66
 
68
-
69
- \#\#\# Read on
70
-
71
- - You can [animate page transitions](/up.motion) by definining animations for fragments as they enter or leave the screen.
72
- - The `up-target` mechanism also works with [forms](/up.form).
73
- - As you switch through pages, Unpoly will [update your browser's location bar and history](/up.history)
74
- - You can [open fragments in popups or modal dialogs](/up.modal).
75
- - You can give users [immediate feedback](/up.navigation) when a link is clicked or becomes current, without waiting for the server.
76
- - [Controlling Unpoly pragmatically through JavaScript](/up.flow)
77
- - [Defining custom tags](/up.syntax)
78
-
79
-
80
67
  @class up.link
81
68
  ###
82
69
 
@@ -99,7 +86,7 @@ up.link = (($) ->
99
86
  @param {String} [options.target='body']
100
87
  The selector to replace.
101
88
  @param {Object} [options]
102
- See options for [`up.replace`](/up.replace)
89
+ See options for [`up.replace()`](/up.replace)
103
90
  @stable
104
91
  ###
105
92
  visit = (url, options) ->
@@ -132,6 +119,8 @@ up.link = (($) ->
132
119
  @param {String} [options.failTarget]
133
120
  The selector to replace if the server responds with a non-200 status code.
134
121
  Defaults to the `up-fail-target` attribute on `link`, or to `body` if such an attribute does not exist.
122
+ @param {String} [options.fallback]
123
+ The selector to update when the original target was not found in the page.
135
124
  @param {String} [options.method='get']
136
125
  The HTTP method to use for the request.
137
126
  @param {String} [options.confirm]
@@ -139,12 +128,14 @@ up.link = (($) ->
139
128
  before the link is followed.
140
129
  @param {Function|String} [options.transition]
141
130
  A transition function or name.
131
+ @param {Function|String} [options.failTransition]
132
+ The transition to use if the server responds with a non-200 status code.
142
133
  @param {Number} [options.duration]
143
- The duration of the transition. See [`up.morph`](/up.morph).
134
+ The duration of the transition. See [`up.morph()`](/up.morph).
144
135
  @param {Number} [options.delay]
145
- The delay before the transition starts. See [`up.morph`](/up.morph).
136
+ The delay before the transition starts. See [`up.morph()`](/up.morph).
146
137
  @param {String} [options.easing]
147
- The timing function that controls the transition's acceleration. [`up.morph`](/up.morph).
138
+ The timing function that controls the transition's acceleration. [`up.morph()`](/up.morph).
148
139
  @param {Element|jQuery|String} [options.reveal]
149
140
  Whether to reveal the target element within its viewport before updating.
150
141
  @param {Boolean} [options.restoreScroll]
@@ -157,6 +148,8 @@ up.link = (($) ->
157
148
  @param {Object} [options.headers={}]
158
149
  An object of additional header key/value pairs to send along
159
150
  with the request.
151
+ @param {Object} [options.timeout={}]
152
+ A timeout in milliseconds for the request.
160
153
  @param {String} [options.layer='auto']
161
154
  The name of the layer that ought to be updated. Valid values are
162
155
  `auto`, `page`, `modal` and `popup`.
@@ -175,8 +168,9 @@ up.link = (($) ->
175
168
  options = u.options(options)
176
169
 
177
170
  url = u.option($link.attr('up-href'), $link.attr('href'))
178
- target = u.option(options.target, $link.attr('up-target'), 'body')
179
- options.failTarget = u.option(options.failTarget, $link.attr('up-fail-target'), 'body')
171
+ target = u.option(options.target, $link.attr('up-target'))
172
+ options.failTarget = u.option(options.failTarget, $link.attr('up-fail-target'))
173
+ options.fallback = u.option(options.fallback, $link.attr('up-fallback'))
180
174
  options.transition = u.option(options.transition, u.castedAttr($link, 'up-transition'), 'none')
181
175
  options.failTransition = u.option(options.failTransition, u.castedAttr($link, 'up-fail-transition'), 'none')
182
176
  options.history = u.option(options.history, u.castedAttr($link, 'up-history'))
@@ -234,7 +228,7 @@ up.link = (($) ->
234
228
  onAction = (selector, handler) ->
235
229
  followVariantSelectors.push(selector)
236
230
  handlerWithActiveMark = ($link) ->
237
- up.navigation.start $link, -> handler($link)
231
+ up.feedback.start $link, -> handler($link)
238
232
  up.on 'click', "a#{selector}, [up-href]#{selector}", (event, $link) ->
239
233
  if shouldProcessLinkEvent(event, $link)
240
234
  if $link.is('[up-instant]')
@@ -298,7 +292,7 @@ up.link = (($) ->
298
292
 
299
293
  <a href="/posts/5" up-target=".main, .unread-count">Read post</a>
300
294
 
301
- \#\#\# Appending or prepending instead of replacing
295
+ \#\#\# Appending or prepending content
302
296
 
303
297
  By default Unpoly will replace the given selector with the same
304
298
  selector from a freshly fetched page. Instead of replacing you
@@ -342,6 +336,8 @@ up.link = (($) ->
342
336
  @param {String} [up-fail-transition='none']
343
337
  The [transition](/up.motion) to use for morphing between the old and new elements
344
338
  when the server responds with a non-200 status code.
339
+ @param {String} [up-fallback]
340
+ The selector to update when the original target was not found in the page.
345
341
  @param {String} [up-href]
346
342
  The destination URL to follow.
347
343
  If omitted, the the link's `href` attribute will be used.
@@ -421,10 +417,12 @@ up.link = (($) ->
421
417
 
422
418
  @param {String} [up-method='get']
423
419
  The HTTP method to use for the request.
424
- @param {String} [up-transition='none']
425
- The [transition](/up.motion) to use for morphing between the old and new elements.
426
420
  @param [up-fail-target='body']
427
421
  The selector to replace if the server responds with a non-200 status code.
422
+ @param {String} [up-fallback]
423
+ The selector to update when the original target was not found in the page.
424
+ @param {String} [up-transition='none']
425
+ The [transition](/up.motion) to use for morphing between the old and new elements.
428
426
  @param {String} [up-fail-transition='none']
429
427
  The [transition](/up.motion) to use for morphing between the old and new elements
430
428
  when the server responds with a non-200 status code.
@@ -512,6 +510,14 @@ up.link = (($) ->
512
510
  <a class="close" href="/records">Close</a>
513
511
  </div>
514
512
 
513
+ \#\#\# Limitations
514
+
515
+ Users will not be able to use the expanded area to open a context menu by right clicking,
516
+ or to open the link in a new tab.
517
+ To enable this, make the entire clickable area an actual `<a>` tag.
518
+ [It's OK to put block elements inside an anchor tag](https://makandracards.com/makandra/43549-it-s-ok-to-put-block-elements-inside-an-a-tag).
519
+
520
+
515
521
  @selector [up-expand]
516
522
  @param {String} [up-expand]
517
523
  A CSS selector that defines which containing link should be expanded.
@@ -53,7 +53,7 @@ up.log = (($) ->
53
53
  ###*
54
54
  Prints a debugging message to the browser console.
55
55
 
56
- @function up.debug
56
+ @function up.log.debug
57
57
  @param {String} message
58
58
  @param {Array} args...
59
59
  @internal
@@ -79,7 +79,7 @@ up.log = (($) ->
79
79
  @internal
80
80
  ###
81
81
  warn = (message, args...) ->
82
- if config.enabled && message
82
+ if message
83
83
  b.puts('warn', prefix(message), args...)
84
84
 
85
85
  ###*