bigskysoftware / bigskysoftware/_hyperscript
unexpected loop behavior when rendering templates.
- Lingua principale
- JavaScript
- Stelle
- 3.8k
- Fork
- 172
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hello and thank you so much for this wonderful language!
Hyperscript completely solves all my tasks on the front end, with the exception of a small problem: SET command in the template's loop doesn't work.
The code from the example of using templates does not work:
```
- ${bg}
@repeat in colors
@set bg to it -- this command return lenght of it, but not it as Object
@set fg to getContrastingColor(it) -- the same problem
@end
```
And this code works:
```
@repeat in colors
@end
```
I found a workaround: using loops directly in DOM elements (when more complex logic is required). I'm not very versed in JavaScript (that's why I chose Hyperscript) to send the pull request, but I hope that this bug causes inconvenience to someone else and it can be fixed.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia riproducendo il template fornito con @repeat e @set, quindi segui il percorso di rendering del template che gestisce le variabili di ciclo e le sostituzioni. Confrontalo con l’esempio funzionante di ciclo direct-DOM; il lavoro è completato quando l’esempio di template esegue il rendering dei valori di sfondo e primo piano previsti senza il workaround.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100