You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: www/expressions.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ main expression types:
47
47
You can refer to an element by ID directly in hyperscript as follows:
48
48
49
49
```html
50
-
<div_="on click put 'Clicked!' into #example.innerHTML">Click Me</div>
50
+
<button_="on click put 'Clicked!' into #example.innerHTML">Click Me</button>
51
51
<divid="example"></div>
52
52
```
53
53
@@ -59,7 +59,7 @@ The `#example` is an ID literal and will evaluate to the element with the given
59
59
You can refer to a group of elements by class directly in hyperscript as follows:
60
60
61
61
```html
62
-
<div_="on click put 'Clicked!' into .example.innerHTML">Click Me</div>
62
+
<button_="on click put 'Clicked!' into .example.innerHTML">Click Me</button>
63
63
<divclass="example"></div>
64
64
<divclass="example"></div>
65
65
```
@@ -68,6 +68,19 @@ The `#example` is an ID literal and will evaluate all the elements with the clas
68
68
text into their `innerHTML` when the top div is clicked. Note that the [put command](/commands/put) can work with
69
69
collections as well as single values, so it can put the given value into all the returned elements.
70
70
71
+
If you want to use non-standard characters in a class name you can escape them using the backslash `\` character. For
72
+
example, consider the complex tailwinds class (`group-[:nth-of-type(3)_&]:block`)[https://tailwindcss.com/docs/hover-focus-and-other-states#arbitrary-groups].
73
+
In this class the following characters are non-standard: `[]()&`. Another common caracter in tailwinds classes is the
74
+
forward slash `/`.
75
+
76
+
Therefore, to express this class in hyperscript you would write the following:
0 commit comments