unpoly-rails 2.5.0 → 2.5.1
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.
- checksums.yaml +4 -4
- data/assets/unpoly/unpoly-migrate.js +18 -14
- data/assets/unpoly/unpoly-migrate.min.js +1 -1
- data/assets/unpoly/unpoly.es5.js +231 -142
- data/assets/unpoly/unpoly.es5.min.js +1 -1
- data/assets/unpoly/unpoly.js +43 -6
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +2 -2
data/assets/unpoly/unpoly.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
@module up
|
9
9
|
*/
|
10
10
|
window.up = {
|
11
|
-
version: '2.5.
|
11
|
+
version: '2.5.1'
|
12
12
|
};
|
13
13
|
|
14
14
|
|
@@ -6903,12 +6903,13 @@ up.Layer.Overlay = class Overlay extends up.Layer {
|
|
6903
6903
|
}
|
6904
6904
|
}
|
6905
6905
|
registerClickCloser(attribute, closeFn) {
|
6906
|
+
let selector = `[${attribute}]`;
|
6906
6907
|
// Allow the fallbacks to be both vanilla links and Unpoly [up-target] links
|
6907
|
-
this.on('up:click',
|
6908
|
+
this.on('up:click', selector, function (event) {
|
6908
6909
|
// Since we're defining this handler on up.Overlay, we will not prevent
|
6909
6910
|
// a link from being followed on the root layer.
|
6910
6911
|
up.event.halt(event);
|
6911
|
-
const origin = event.target;
|
6912
|
+
const origin = event.target.closest(selector);
|
6912
6913
|
const value = e.jsonAttr(origin, attribute);
|
6913
6914
|
const closeOptions = { origin };
|
6914
6915
|
const parser = new up.OptionsParser(closeOptions, origin);
|
@@ -19531,10 +19532,13 @@ up.link = (function () {
|
|
19531
19532
|
})
|
19532
19533
|
```
|
19533
19534
|
|
19534
|
-
### Cancelation
|
19535
|
+
### Cancelation
|
19535
19536
|
|
19536
|
-
|
19537
|
-
|
19537
|
+
You may cancel an `up:click` event using `event.preventDefault()`.
|
19538
|
+
|
19539
|
+
Canceling `up:click` on a hyperlink will prevent any Unpoly from [following](/a-up-follow) that link.
|
19540
|
+
|
19541
|
+
The underlying `click` or `mousedown` event will also be canceled.
|
19538
19542
|
|
19539
19543
|
### Accessibility
|
19540
19544
|
|
@@ -19553,6 +19557,8 @@ up.link = (function () {
|
|
19553
19557
|
The clicked element.
|
19554
19558
|
@param {Event} event.originalEvent
|
19555
19559
|
The underlying `click` or `mousedown` event.
|
19560
|
+
@param event.preventDefault()
|
19561
|
+
Prevents this event and also the original `click` or `mousedown` event.
|
19556
19562
|
@stable
|
19557
19563
|
*/
|
19558
19564
|
/*-
|
@@ -19608,6 +19614,14 @@ up.link = (function () {
|
|
19608
19614
|
|
19609
19615
|
See [Handling all links and forms](/handling-everything).
|
19610
19616
|
|
19617
|
+
### Preventing Unpoly from following links
|
19618
|
+
|
19619
|
+
To prevent Unpoly from following an `a[up-follow]` link, use one of the following options:
|
19620
|
+
|
19621
|
+
- Prevent the `up:link:follow` event on the link element
|
19622
|
+
- Prevent the `up:click` event on the link element
|
19623
|
+
- Set an `[up-follow=false]` attribute on the link element
|
19624
|
+
|
19611
19625
|
@selector a[up-follow]
|
19612
19626
|
|
19613
19627
|
@param [up-navigate='true']
|
@@ -20956,6 +20970,9 @@ up.form = (function () {
|
|
20956
20970
|
/*-
|
20957
20971
|
Show or hide elements when a form field is set to a given value.
|
20958
20972
|
|
20973
|
+
When the controlling form field gets an `up-switch` attribute, and that form field is nested inside a `<form>`
|
20974
|
+
parent, the targets elements must also be inside that same `<form>` parent.
|
20975
|
+
|
20959
20976
|
### Example: Select options
|
20960
20977
|
|
20961
20978
|
The controlling form field gets an `up-switch` attribute with a selector for the elements to show or hide:
|
@@ -21034,6 +21051,26 @@ up.form = (function () {
|
|
21034
21051
|
</div>
|
21035
21052
|
```
|
21036
21053
|
|
21054
|
+
### Example: Radio button
|
21055
|
+
|
21056
|
+
```html
|
21057
|
+
<input type="radio" name="advancedness" value="basic" up-switch=".target">
|
21058
|
+
<input type="radio" name="advancedness" value="advanced" up-switch=".target">
|
21059
|
+
<input type="radio" name="advancedness" value="very-advanced" up-switch=".target">
|
21060
|
+
|
21061
|
+
<div class="target" up-show-for="basic">
|
21062
|
+
only shown for advancedness = basic
|
21063
|
+
</div>
|
21064
|
+
|
21065
|
+
<div class="target" up-hide-for="basic">
|
21066
|
+
hidden for advancedness = basic
|
21067
|
+
</div>
|
21068
|
+
|
21069
|
+
<div class="target" up-show-for="advanced very-advanced">
|
21070
|
+
shown for advancedness = advanced or very-advanced
|
21071
|
+
</div>
|
21072
|
+
```
|
21073
|
+
|
21037
21074
|
@selector input[up-switch]
|
21038
21075
|
@param up-switch
|
21039
21076
|
A CSS selector for elements whose visibility depends on this field's value.
|