Add custom data attribute support

This commit is contained in:
Joscha 2024-11-26 23:46:12 +01:00
parent 43b3236d3b
commit bc7a659303

View file

@ -90,6 +90,10 @@ impl Element {
self.attr(name, "")
}
pub fn data(self, name: impl ToString, value: impl ToString) -> Self {
self.attr(format!("data-{}", name.to_string()), value)
}
pub fn child(mut self, child: impl Into<Content>) -> Self {
self.children.push(child.into());
self