mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-28 13:43:01 -05:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86b78640e7 |
@@ -540,20 +540,11 @@ impl IntoClass for (&'static str, bool) {
|
||||
fn rebuild(self, state: &mut Self::State) {
|
||||
let (name, include) = self;
|
||||
let (class_list, prev_include, prev_name) = state;
|
||||
if name == *prev_name {
|
||||
if include != *prev_include {
|
||||
if include {
|
||||
Rndr::add_class(class_list, name);
|
||||
} else {
|
||||
Rndr::remove_class(class_list, name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if *prev_include {
|
||||
Rndr::remove_class(class_list, prev_name);
|
||||
}
|
||||
if include != *prev_include {
|
||||
if include {
|
||||
Rndr::add_class(class_list, name);
|
||||
} else {
|
||||
Rndr::remove_class(class_list, name);
|
||||
}
|
||||
}
|
||||
*prev_include = include;
|
||||
|
||||
@@ -709,7 +709,7 @@ where
|
||||
|
||||
buf.push('<');
|
||||
buf.push_str(E::TAG);
|
||||
<At as ToTemplate>::to_template(
|
||||
<At as ToTemplate>::to_template_attribute(
|
||||
buf,
|
||||
&mut class,
|
||||
&mut style,
|
||||
|
||||
@@ -209,15 +209,6 @@ where
|
||||
|
||||
fn rebuild(self, state: &mut Self::State) {
|
||||
let (name, mut f) = self;
|
||||
|
||||
let prev_name = state.name;
|
||||
let prev_state = state.effect.take_value();
|
||||
if let Some((list, prev_include)) = &prev_state {
|
||||
if prev_name != name && *prev_include {
|
||||
Rndr::remove_class(list, prev_name);
|
||||
}
|
||||
}
|
||||
|
||||
// Name might've updated:
|
||||
state.name = name;
|
||||
let mut first_run = true;
|
||||
@@ -241,7 +232,7 @@ where
|
||||
}
|
||||
}
|
||||
},
|
||||
prev_state,
|
||||
state.effect.take_value(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<A: Render> Render for (A,) {
|
||||
|
||||
Reference in New Issue
Block a user