@@ -105,13 +105,13 @@ Set style value.
105
105
106
106
``` html
107
107
<!-- extends style -->
108
- <div style =" foo : bar" :style =" 'baz -baz: qux'" >
108
+ <div style =" foo : bar" :style =" 'bar -baz: qux'" >
109
109
110
110
<!-- object -->
111
- <div :style =" {bazBaz : 'qux'}" ></div >
111
+ <div :style =" {barBaz : 'qux'}" ></div >
112
112
113
113
<!-- CSS variable -->
114
- <div :style =" {'--baz -baz': qux}" ></div >
114
+ <div :style =" {'--bar -baz': qux}" ></div >
115
115
```
116
116
117
117
#### ` :value="value" `
@@ -163,8 +163,8 @@ Expose element with `name`.
163
163
<textarea :ref =" text" placeholder =" Enter text..." ></textarea >
164
164
165
165
<!-- iterable items -->
166
- <li :each =" item in items" :ref =" item " >
167
- <input :onfocus..onblur =" e => (item .classList.add('editing'), e => item .classList.remove('editing'))" />
166
+ <li :each =" item in items" :ref =" li " >
167
+ <input :onfocus..onblur =" e => (li .classList.add('editing'), e => li .classList.remove('editing'))" />
168
168
</li >
169
169
```
170
170
@@ -176,7 +176,7 @@ Run effect, not changing any attribute.
176
176
<div :fx =" a.value ? foo() : bar()" />
177
177
178
178
<!-- cleanup function -->
179
- <div :fx =" id = setInterval(tick, interval ), () => clearInterval(tick )" />
179
+ <div :fx =" id = setInterval(tick, 1000 ), () => clearInterval(id )" />
180
180
```
181
181
182
182
#### ` :on<event>="handler" ` , ` :on<in>..on<out>="handler" `
@@ -375,6 +375,8 @@ sprae.use({ compile })
375
375
* State getters/setters work as computed effects, eg. ` sprae(el, { x:1, get x2(){ return this.x * 2} }) ` .
376
376
* ` this ` keyword is not used, to get access to current element use ` <input :ref="el" :text="el.value"/> ` .
377
377
* Async/await is not supported in attributes, it's a strong indicator you need to put these methods into state.
378
+ * ` :each ` doesn't need ` key ` since it uses direct mapping, see [ #44 ] ( https://github.com/dy/sprae/issues/44 ) .
379
+ * Event attributes always expect a function value ` :onevt="event => handle()" ` , see [ #46 ] ( https://github.com/dy/sprae/issues/46 ) .
378
380
379
381
## Justification
380
382
0 commit comments