about summary refs log tree commit diff stats
path: root/html/elements.go
diff options
context:
space:
mode:
authorMarkus Wüstenberg2024-06-06 11:56:27 +0200
committerMarkus Wüstenberg2024-06-06 11:56:27 +0200
commitd55a223e8af294678f10126bff9057ec38d7d978 (patch)
tree7e5e5770b4d2d6490c14809eedda325ee9efef7f /html/elements.go
parentd944acd39fd6c987ea3cdd57c2cec525e918425e (diff)
downloadgomponents-d55a223e8af294678f10126bff9057ec38d7d978.tar.lz
gomponents-d55a223e8af294678f10126bff9057ec38d7d978.tar.zst
gomponents-d55a223e8af294678f10126bff9057ec38d7d978.zip
Deprecate DataAttr, StyleAttr, TitleAttr, FormEl
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 `data` 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.
Diffstat (limited to 'html/elements.go')
-rw-r--r--html/elements.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/html/elements.go b/html/elements.go
index 79db67f..eb6fbc2 100644
--- a/html/elements.go
+++ b/html/elements.go
@@ -111,6 +111,11 @@ func Embed(children ...g.Node) g.Node {
 	return g.El("embed", children...)
 }
 
+func Form(children ...g.Node) g.Node {
+	return g.El("form", children...)
+}
+
+// Deprecated: Use [Form] instead.
 func FormEl(children ...g.Node) g.Node {
 	return g.El("form", children...)
 }