all repos — gomponents @ 81b2d6a9e39ff8859400bfa806cb3e712049615c

HTML components in pure Go

Deprecate DataAttr, StyleAttr, TitleAttr, FormEl (#174) This change addresses #170 by deprecating some HTML helpers in favor of using one of the styles as a main one, selected based on what I think is the main use case. - For `Data`, it's the attribute. I don't see much use of the `<data>` element in the wild. - For `Style`, it's the attribute. The `style` attribute is everywhere, the `<style>` element is perhaps less so (but not much). This was the hardest one to decide. - For `Title`, it's the attribute. The `<title>` element only shows up once per document. - For `Form`, it's the element. I haven't seen much use of the `form` attribute in the wild. I know this is arguably not a "consistent" approach, but I think it makes for a much nicer API, simply because the most-used option will not be a suffixed version.

Markus Wüstenberg
commit

81b2d6a9e39ff8859400bfa806cb3e712049615c

parent

d944acd39fd6c987ea3cdd57c2cec525e918425e

1 file changed, 6 insertions(+), 5 deletions(-)

changed files
M README.mdREADME.md
@@ -146,9 +146,10 @@
### What's up with the specially named elements and attributes? Unfortunately, there are four main name clashes in HTML elements and attributes, so they need an `El` or `Attr` suffix, -respectively, to be able to co-exist in the same package in Go: +to be able to co-exist in the same package in Go. I've chosen one or the other based on what I think is the common usage. +In either case, the less-used variant also exists in the codebase: -- `data` (`DataEl`/`DataAttr`) -- `form` (`FormEl`/`FormAttr`) -- `style` (`StyleEl`/`StyleAttr`) -- `title` (`TitleEl`/`TitleAttr`) +- `data` (`DataEl`/`Data`, `DataAttr` also exists) +- `form` (`Form`/`FormAttr`, `FormEl` also exists) +- `style` (`StyleEl`/`Style`, `StyleAttr` also exists) +- `title` (`TitleEl`/`Title`, `TitleAttr` also exists)