Sorry in advance in case I have missed an issue related to this.
There are cases where a map[string]templ.ComponentScript might make sense but spreading or iterating is not possible on the attributes side. Tried to do a spread with templ.Attributes but those are not templ scripts so it makes sense that they do not work.
jsMap := map[string]templ.ComponentScript{
"onclick": alert(),
}
Example A (spread):
<button { jsMap... }>Foo</button>
Example B (for):
<button
for evt, fn := range jsMap {
{evt}={fn}
}
>Foo</button>
Personally I think it would be better to support a for under attributes. Also, a for even for templ.Attributes would be interesting.
Sorry in advance in case I have missed an issue related to this.
There are cases where a
map[string]templ.ComponentScriptmight make sense but spreading or iterating is not possible on the attributes side. Tried to do a spread withtempl.Attributesbut those are not templ scripts so it makes sense that they do not work.Example A (spread):
Example B (for):
Personally I think it would be better to support a
forunder attributes. Also, aforeven fortempl.Attributeswould be interesting.