all repos — gomponents @ aa31c287a17885091d2dd9111f3eb798ee2ad91a

HTML components in pure Go

Merge remote-tracking branch 'upstream/main'

Alan Pearce
commit

aa31c287a17885091d2dd9111f3eb798ee2ad91a

parent

16f98a2bdbcfa112fb73fe318e88d497318ff8b3

1 file changed, 21 insertions(+), 0 deletions(-)

changed files
M README.mdREADME.md
@@ -124,6 +124,27 @@ I accept code contributions, especially with new HTML elements and attributes.
I always welcome issues discussing interesting aspects of gomponents, and obviously bug reports and the like. But otherwise, I consider gomponents pretty much feature complete. +New features to the core library are unlikely to be merged, since I like keeping it simple and the API small. +In particular, new functions around collections (similar to `Map`) or flow control (`IfElse`/`Else`) will not be added. +`Map` was introduced before generics were a thing, and I think it's better to start using generic functions +from the stdlib or other libraries, instead of adding gomponents-specific variations of them to this library. + +If there's something missing that you need, I would recommend to keep small helper functions around in your own projects. +And if all else fails, you can always use an [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE): + +```go +func list(ordered bool) Node { + return func() Node { + // Do whatever you need to do, imperatively + if ordered { + return Ol() + } else { + return Ul() + } + }() +} +``` + ### What's up with the specially named elements and attributes? Unfortunately, there are some name clashes in HTML elements and attributes, so they need an `El` or `Attr` suffix,