diff --git a/tachys/src/html/element/mod.rs b/tachys/src/html/element/mod.rs
index dea8a6a51..3b5858bdb 100644
--- a/tachys/src/html/element/mod.rs
+++ b/tachys/src/html/element/mod.rs
@@ -709,7 +709,7 @@ where
buf.push('<');
buf.push_str(E::TAG);
- ::to_template(
+ ::to_template_attribute(
buf,
&mut class,
&mut style,
diff --git a/tachys/src/view/mod.rs b/tachys/src/view/mod.rs
index 89d910526..479810514 100644
--- a/tachys/src/view/mod.rs
+++ b/tachys/src/view/mod.rs
@@ -437,6 +437,17 @@ pub trait ToTemplate {
inner_html: &mut String,
position: &mut Position,
);
+
+ /// Renders a view type to a template in attribute position.
+ fn to_template_attribute(
+ buf: &mut String,
+ class: &mut String,
+ style: &mut String,
+ inner_html: &mut String,
+ position: &mut Position,
+ ) {
+ Self::to_template(buf, class, style, inner_html, position);
+ }
}
/// Keeps track of what position the item currently being hydrated is in, relative to its siblings
diff --git a/tachys/src/view/tuples.rs b/tachys/src/view/tuples.rs
index 220fc92fb..2513d086a 100644
--- a/tachys/src/view/tuples.rs
+++ b/tachys/src/view/tuples.rs
@@ -103,6 +103,15 @@ impl ToTemplate for () {
) {
buf.push_str("");
}
+
+ fn to_template_attribute(
+ _buf: &mut String,
+ _class: &mut String,
+ _style: &mut String,
+ _inner_html: &mut String,
+ _position: &mut Position,
+ ) {
+ }
}
impl Render for (A,) {