Skip to content

Commit 48d3620

Browse files
committed
deprecate [@ syntax :/
1 parent c3b1687 commit 48d3620

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

www/expressions.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,13 @@ This example will toggle the `data-theme='light'` property on `:root` so we can
124124

125125
### Attribute Literals
126126

127-
Finally, you can refer to an attribute with two syntaxes:
127+
You can refer to an attribute using the `@` syntax:
128128

129129
```html
130130
<div foo="bar" _="on click put @foo into me">Click Me</div>
131-
<div _="on click toggle [@foo='bar'] into me">Click Me</div>
132131
```
133132

134-
The short syntax, `@<attribute name>` can be used to get or set attribute values, and may be chained with
133+
The `@<attribute name>` syntax can be used to get or set attribute values, and may be chained with
135134
possessives:
136135

137136
```hyperscript
@@ -148,15 +147,15 @@ for anchor in <a/>
148147
end
149148
```
150149

151-
The longer syntax, surrounding the `@<attribute-name>` with square brackets, may be used for queries that require a
152-
value, or for commands like `toggle` or `add` that require a value
150+
You can also specify a value with the `@` syntax, which is useful for commands like `toggle` or `add`:
153151

154152
```hyperscript
155-
for anchor in [@href]
156-
log anchor@href
157-
end
153+
toggle @foo="bar" on me
154+
add @disabled
158155
```
159156

157+
> **Deprecated:** The bracket syntax `[@foo]` / `[@foo="bar"]` is deprecated. Use `@foo` / `@foo="bar"` instead.
158+
160159
### In Expressions
161160

162161
The `in` expression isn't a literal, but can be used in conjunction with them for common patterns:

0 commit comments

Comments
 (0)