@alpinejs/docs 3.10.2-revision.2 → 3.10.3-revision.1
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.
package/package.json
CHANGED
package/src/en/directives/on.md
CHANGED
|
@@ -13,7 +13,7 @@ Here's an example of simple button that shows an alert when clicked.
|
|
|
13
13
|
<button x-on:click="alert('Hello World!')">Say Hi</button>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
> `x-on` can only listen for events with lower case names, as HTML attributes are case-insensitive. Writing `x-on:CLICK` will listen for an event named `click`. If you need to listen for a custom event with a camelCase name, you can use the [`.camel` helper](#camel) to work around this limitation. Alternatively, you can use [`x-bind`](/directives/bind
|
|
16
|
+
> `x-on` can only listen for events with lower case names, as HTML attributes are case-insensitive. Writing `x-on:CLICK` will listen for an event named `click`. If you need to listen for a custom event with a camelCase name, you can use the [`.camel` helper](#camel) to work around this limitation. Alternatively, you can use [`x-bind`](/directives/bind#bind-directives) to attach an `x-on` directive to an element in javascript code (where case will be preserved).
|
|
17
17
|
|
|
18
18
|
<a name="shorthand-syntax"></a>
|
|
19
19
|
## Shorthand syntax
|
|
@@ -81,7 +81,7 @@ For easy reference, here is a list of common keys you may want to listen for.
|
|
|
81
81
|
| `.space` | Space |
|
|
82
82
|
| `.ctrl` | Ctrl |
|
|
83
83
|
| `.cmd` | Cmd |
|
|
84
|
-
| `.meta` | Cmd on Mac,
|
|
84
|
+
| `.meta` | Cmd on Mac, Windows key on Windows |
|
|
85
85
|
| `.alt` | Alt |
|
|
86
86
|
| `.up` `.down` `.left` `.right` | Up/Down/Left/Right arrows |
|
|
87
87
|
| `.escape` | Escape |
|
|
@@ -37,3 +37,20 @@ If you want to apply smooth transitions to the `x-show` behavior, you can use it
|
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
39
39
|
```
|
|
40
|
+
|
|
41
|
+
<a name="using-the-important-modifier"></a>
|
|
42
|
+
## Using the important modifier
|
|
43
|
+
|
|
44
|
+
Sometimes you need to apply a little more force to actually hide an element. In cases where a CSS selector applies the `display` property with the `!important` flag, it will take precedence over the inline style set by Alpine.
|
|
45
|
+
|
|
46
|
+
In these cases you may use the `.important` modifier to set the inline style to `display: none !important`.
|
|
47
|
+
|
|
48
|
+
```alpine
|
|
49
|
+
<div x-data="{ open: false }">
|
|
50
|
+
<button x-on:click="open = ! open">Toggle Dropdown</button>
|
|
51
|
+
|
|
52
|
+
<div x-show.important="open">
|
|
53
|
+
Dropdown Contents...
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
```
|
|
@@ -33,7 +33,7 @@ This is by far the simplest way to get started with Alpine. Include the followin
|
|
|
33
33
|
Notice the `@3.x.x` in the provided CDN link. This will pull the latest version of Alpine version 3. For stability in production, it's recommended that you hardcode the latest version in the CDN link.
|
|
34
34
|
|
|
35
35
|
```alpine
|
|
36
|
-
<script defer src="https://unpkg.com/alpinejs@3.10.
|
|
36
|
+
<script defer src="https://unpkg.com/alpinejs@3.10.3/dist/cdn.min.js"></script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
That's it! Alpine is now available for use inside your page.
|