fix remaining core tests
This commit is contained in:
1 parent
51441b44ca
commit
b039d6acc0
11 files changed
+174
-170
No files matched your search
@@ -62,7 +62,7 @@ fn keyed_diffing_out_of_order_adds() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
@@ -88,7 +88,7 @@ fn keyed_diffing_out_of_order_adds_3() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
@@ -114,7 +114,7 @@ fn keyed_diffing_out_of_order_adds_4() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
@@ -140,7 +140,7 @@ fn keyed_diffing_out_of_order_adds_5() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
@@ -165,7 +165,7 @@ fn keyed_diffing_additions() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
@@ -190,7 +190,7 @@ fn keyed_diffing_additions_and_moves_on_ends() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
@@ -219,7 +219,7 @@ fn keyed_diffing_additions_and_moves_in_middle() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
// LIS: 4, 5, 6
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
@@ -253,7 +253,7 @@ fn controlled_keyed_diffing_out_of_order() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
// LIS: 5, 6
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
@@ -287,7 +287,7 @@ fn controlled_keyed_diffing_out_of_order_max_test() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
@@ -316,7 +316,7 @@ fn remove_list() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
@@ -341,7 +341,7 @@ fn no_common_keys() {
|
||||
render!({ order.iter().map(|i| render!(div { key: "{i}" })) })
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
assert_eq!(
|
||||
|
||||
@@ -282,7 +282,7 @@ fn two_equal_fragments_are_equal_static() {
|
||||
}
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
assert!(dom.render_immediate_to_vec().edits.is_empty());
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ fn two_equal_fragments_are_equal() {
|
||||
}
|
||||
});
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
assert!(dom.render_immediate_to_vec().edits.is_empty());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use dioxus::prelude::*;
|
||||
#[test]
|
||||
fn catches_panic() {
|
||||
let mut dom = VirtualDom::new(app);
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
|
||||
@@ -9,7 +9,7 @@ fn events_propagate() {
|
||||
set_event_converter(Box::new(dioxus_html::SerializedHtmlEventConverter));
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
// Top-level click is registered
|
||||
dom.handle_event(
|
||||
|
||||
@@ -25,7 +25,7 @@ fn manual_diffing() {
|
||||
let value = Arc::new(Mutex::new("Hello"));
|
||||
let mut dom = VirtualDom::new_with_props(app, AppProps { value: value.clone() });
|
||||
|
||||
let _ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
*value.lock().unwrap() = "goodbye";
|
||||
|
||||
@@ -57,7 +57,7 @@ fn events_generate() {
|
||||
};
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
dom.handle_event(
|
||||
"click",
|
||||
|
||||
@@ -9,7 +9,7 @@ fn miri_rollover() {
|
||||
set_event_converter(Box::new(SerializedHtmlEventConverter));
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
for _ in 0..3 {
|
||||
dom.handle_event(
|
||||
|
||||
@@ -8,7 +8,7 @@ fn app_drops() {
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
_ = dom.render_immediate_to_vec();
|
||||
}
|
||||
@@ -26,7 +26,7 @@ fn hooks_drop() {
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
_ = dom.render_immediate_to_vec();
|
||||
}
|
||||
@@ -49,7 +49,7 @@ fn contexts_drop() {
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
_ = dom.render_immediate_to_vec();
|
||||
}
|
||||
@@ -66,7 +66,7 @@ fn tasks_drop() {
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
_ = dom.render_immediate_to_vec();
|
||||
}
|
||||
@@ -81,7 +81,7 @@ fn root_props_drop() {
|
||||
RootProps("asdasd".to_string()),
|
||||
);
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
_ = dom.render_immediate_to_vec();
|
||||
}
|
||||
@@ -111,7 +111,7 @@ fn diffing_drops_old() {
|
||||
}
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
|
||||
_ = dom.render_immediate_to_vec();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core::NoOpMutations;
|
||||
|
||||
/// This test checks that we should release all memory used by the virtualdom when it exits.
|
||||
///
|
||||
@@ -59,7 +60,7 @@ fn test_memory_leak() {
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
for _ in 0..5 {
|
||||
dom.mark_dirty(ScopeId::ROOT);
|
||||
@@ -95,7 +96,7 @@ fn memo_works_properly() {
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
// todo!()
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
// dom.hard_diff(ScopeId::ROOT);
|
||||
@@ -127,10 +128,10 @@ fn free_works_on_root_hooks() {
|
||||
|
||||
let ptr = Rc::new("asdasd".to_string());
|
||||
let mut dom = VirtualDom::new_with_props(app, AppProps { inner: ptr.clone() });
|
||||
let _ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
// ptr gets cloned into props and then into the hook
|
||||
assert_eq!(Rc::strong_count(&ptr), 4);
|
||||
assert_eq!(Rc::strong_count(&ptr), 5);
|
||||
|
||||
drop(dom);
|
||||
|
||||
@@ -148,21 +149,25 @@ fn supports_async() {
|
||||
|
||||
use_hook(|| {
|
||||
spawn(async move {
|
||||
sleep(Duration::from_millis(1000)).await;
|
||||
colors.with_mut(|colors| colors.reverse());
|
||||
loop {
|
||||
sleep(Duration::from_millis(1000)).await;
|
||||
colors.with_mut(|colors| colors.reverse());
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
use_hook(|| {
|
||||
spawn(async move {
|
||||
sleep(Duration::from_millis(10)).await;
|
||||
padding.with_mut(|padding| {
|
||||
if *padding < 65 {
|
||||
*padding += 1;
|
||||
} else {
|
||||
*padding = 5;
|
||||
}
|
||||
});
|
||||
loop {
|
||||
sleep(Duration::from_millis(10)).await;
|
||||
padding.with_mut(|padding| {
|
||||
if *padding < 65 {
|
||||
*padding += 1;
|
||||
} else {
|
||||
*padding = 5;
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -189,11 +194,11 @@ fn supports_async() {
|
||||
|
||||
rt.block_on(async {
|
||||
let mut dom = VirtualDom::new(app);
|
||||
let _ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
for _ in 0..10 {
|
||||
dom.wait_for_work().await;
|
||||
let _edits = dom.render_immediate_to_vec();
|
||||
dom.render_immediate(&mut NoOpMutations);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
fn suspense_resolves() {
|
||||
// wait just a moment, not enough time for the boundary to resolve
|
||||
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
@@ -9,7 +9,7 @@ fn it_works() {
|
||||
.unwrap()
|
||||
.block_on(async {
|
||||
let mut dom = VirtualDom::new(app);
|
||||
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.wait_for_suspense().await;
|
||||
let out = dioxus_ssr::render(&dom);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ async fn it_works() {
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
let _ = dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
dom.rebuild(&mut dioxus_core::NoOpMutations);
|
||||
|
||||
tokio::select! {
|
||||
_ = dom.wait_for_work() => {}
|
||||
|
||||
+126
-127
@@ -80,146 +80,145 @@ impl Renderer {
|
||||
})
|
||||
.clone();
|
||||
|
||||
// let mut inner_html = None;
|
||||
let mut inner_html = None;
|
||||
|
||||
// // We need to keep track of the dynamic styles so we can insert them into the right place
|
||||
// let mut accumulated_dynamic_styles = Vec::new();
|
||||
// We need to keep track of the dynamic styles so we can insert them into the right place
|
||||
let mut accumulated_dynamic_styles = Vec::new();
|
||||
|
||||
// // We need to keep track of the listeners so we can insert them into the right place
|
||||
// let mut accumulated_listeners = Vec::new();
|
||||
// We need to keep track of the listeners so we can insert them into the right place
|
||||
let mut accumulated_listeners = Vec::new();
|
||||
|
||||
// for segment in entry.segments.iter() {
|
||||
// match segment {
|
||||
// Segment::Attr(idx) => {
|
||||
// let attr = &template.dynamic_attrs[*idx];
|
||||
// attr.attribute_type().try_for_each(|attr| {
|
||||
// if attr.name == "dangerous_inner_html" {
|
||||
// inner_html = Some(attr);
|
||||
// } else if attr.namespace == Some("style") {
|
||||
// accumulated_dynamic_styles.push(attr);
|
||||
// } else if BOOL_ATTRS.contains(&attr.name) {
|
||||
// if truthy(&attr.value) {
|
||||
// write_attribute(buf, attr)?;
|
||||
// }
|
||||
// } else {
|
||||
// write_attribute(buf, attr)?;
|
||||
// }
|
||||
for segment in entry.segments.iter() {
|
||||
match segment {
|
||||
Segment::Attr(idx) => {
|
||||
let attrs = &*template.dynamic_attrs[*idx];
|
||||
for attr in attrs {
|
||||
if attr.name == "dangerous_inner_html" {
|
||||
inner_html = Some(attr);
|
||||
} else if attr.namespace == Some("style") {
|
||||
accumulated_dynamic_styles.push(attr);
|
||||
} else if BOOL_ATTRS.contains(&attr.name) {
|
||||
if truthy(&attr.value) {
|
||||
write_attribute(buf, attr)?;
|
||||
}
|
||||
} else {
|
||||
write_attribute(buf, attr)?;
|
||||
}
|
||||
|
||||
// if self.pre_render {
|
||||
// if let AttributeValue::Listener(_) = &attr.value {
|
||||
// // The onmounted event doesn't need a DOM listener
|
||||
// if attr.name != "onmounted" {
|
||||
// accumulated_listeners.push(attr.name);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Ok(())
|
||||
// })?;
|
||||
// }
|
||||
// Segment::Node(idx) => match &template.dynamic_nodes[*idx] {
|
||||
// DynamicNode::Component(node) => {
|
||||
// if self.skip_components {
|
||||
// write!(buf, "<{}><{}/>", node.name, node.name)?;
|
||||
// } else {
|
||||
// let scope = node.mounted_scope(*idx, template, dom).unwrap();
|
||||
// let node = scope.root_node();
|
||||
// match node {
|
||||
// RenderReturn::Ready(node) => {
|
||||
// self.render_template(buf, dom, node)?
|
||||
// }
|
||||
// _ => todo!(
|
||||
// "generally, scopes should be sync, only if being traversed"
|
||||
// ),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// DynamicNode::Text(text) => {
|
||||
// // in SSR, we are concerned that we can't hunt down the right text node since they might get merged
|
||||
// if self.pre_render {
|
||||
// write!(buf, "<!--node-id{}-->", self.dynamic_node_id)?;
|
||||
// self.dynamic_node_id += 1;
|
||||
// }
|
||||
if self.pre_render {
|
||||
if let AttributeValue::Listener(_) = &attr.value {
|
||||
// The onmounted event doesn't need a DOM listener
|
||||
if attr.name != "onmounted" {
|
||||
accumulated_listeners.push(attr.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Segment::Node(idx) => match &template.dynamic_nodes[*idx] {
|
||||
DynamicNode::Component(node) => {
|
||||
if self.skip_components {
|
||||
write!(buf, "<{}><{}/>", node.name, node.name)?;
|
||||
} else {
|
||||
let scope = node.mounted_scope(*idx, template, dom).unwrap();
|
||||
let node = scope.root_node();
|
||||
match node {
|
||||
RenderReturn::Ready(node) => {
|
||||
self.render_template(buf, dom, node)?
|
||||
}
|
||||
_ => todo!(
|
||||
"generally, scopes should be sync, only if being traversed"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
DynamicNode::Text(text) => {
|
||||
// in SSR, we are concerned that we can't hunt down the right text node since they might get merged
|
||||
if self.pre_render {
|
||||
write!(buf, "<!--node-id{}-->", self.dynamic_node_id)?;
|
||||
self.dynamic_node_id += 1;
|
||||
}
|
||||
|
||||
// write!(
|
||||
// buf,
|
||||
// "{}",
|
||||
// askama_escape::escape(&text.value, askama_escape::Html)
|
||||
// )?;
|
||||
write!(
|
||||
buf,
|
||||
"{}",
|
||||
askama_escape::escape(&text.value, askama_escape::Html)
|
||||
)?;
|
||||
|
||||
// if self.pre_render {
|
||||
// write!(buf, "<!--#-->")?;
|
||||
// }
|
||||
// }
|
||||
// DynamicNode::Fragment(nodes) => {
|
||||
// for child in nodes {
|
||||
// self.render_template(buf, dom, child)?;
|
||||
// }
|
||||
// }
|
||||
if self.pre_render {
|
||||
write!(buf, "<!--#-->")?;
|
||||
}
|
||||
}
|
||||
DynamicNode::Fragment(nodes) => {
|
||||
for child in nodes {
|
||||
self.render_template(buf, dom, child)?;
|
||||
}
|
||||
}
|
||||
|
||||
// DynamicNode::Placeholder(_) => {
|
||||
// if self.pre_render {
|
||||
// write!(
|
||||
// buf,
|
||||
// "<pre data-node-hydration={}></pre>",
|
||||
// self.dynamic_node_id
|
||||
// )?;
|
||||
// self.dynamic_node_id += 1;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
DynamicNode::Placeholder(_) => {
|
||||
if self.pre_render {
|
||||
write!(
|
||||
buf,
|
||||
"<pre data-node-hydration={}></pre>",
|
||||
self.dynamic_node_id
|
||||
)?;
|
||||
self.dynamic_node_id += 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Segment::PreRendered(contents) => write!(buf, "{contents}")?,
|
||||
Segment::PreRendered(contents) => write!(buf, "{contents}")?,
|
||||
|
||||
// Segment::StyleMarker { inside_style_tag } => {
|
||||
// if !accumulated_dynamic_styles.is_empty() {
|
||||
// // if we are inside a style tag, we don't need to write the style attribute
|
||||
// if !*inside_style_tag {
|
||||
// write!(buf, " style=\"")?;
|
||||
// }
|
||||
// for attr in &accumulated_dynamic_styles {
|
||||
// write!(buf, "{}:", attr.name)?;
|
||||
// write_value_unquoted(buf, &attr.value)?;
|
||||
// write!(buf, ";")?;
|
||||
// }
|
||||
// if !*inside_style_tag {
|
||||
// write!(buf, "\"")?;
|
||||
// }
|
||||
Segment::StyleMarker { inside_style_tag } => {
|
||||
if !accumulated_dynamic_styles.is_empty() {
|
||||
// if we are inside a style tag, we don't need to write the style attribute
|
||||
if !*inside_style_tag {
|
||||
write!(buf, " style=\"")?;
|
||||
}
|
||||
for attr in &accumulated_dynamic_styles {
|
||||
write!(buf, "{}:", attr.name)?;
|
||||
write_value_unquoted(buf, &attr.value)?;
|
||||
write!(buf, ";")?;
|
||||
}
|
||||
if !*inside_style_tag {
|
||||
write!(buf, "\"")?;
|
||||
}
|
||||
|
||||
// // clear the accumulated styles
|
||||
// accumulated_dynamic_styles.clear();
|
||||
// }
|
||||
// }
|
||||
// clear the accumulated styles
|
||||
accumulated_dynamic_styles.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Segment::InnerHtmlMarker => {
|
||||
// if let Some(inner_html) = inner_html.take() {
|
||||
// let inner_html = &inner_html.value;
|
||||
// match inner_html {
|
||||
// AttributeValue::Text(value) => write!(buf, "{}", value)?,
|
||||
// AttributeValue::Bool(value) => write!(buf, "{}", value)?,
|
||||
// AttributeValue::Float(f) => write!(buf, "{}", f)?,
|
||||
// AttributeValue::Int(i) => write!(buf, "{}", i)?,
|
||||
// _ => {}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Segment::InnerHtmlMarker => {
|
||||
if let Some(inner_html) = inner_html.take() {
|
||||
let inner_html = &inner_html.value;
|
||||
match inner_html {
|
||||
AttributeValue::Text(value) => write!(buf, "{}", value)?,
|
||||
AttributeValue::Bool(value) => write!(buf, "{}", value)?,
|
||||
AttributeValue::Float(f) => write!(buf, "{}", f)?,
|
||||
AttributeValue::Int(i) => write!(buf, "{}", i)?,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Segment::AttributeNodeMarker => {
|
||||
// // first write the id
|
||||
// write!(buf, "{}", self.dynamic_node_id)?;
|
||||
// self.dynamic_node_id += 1;
|
||||
// // then write any listeners
|
||||
// for name in accumulated_listeners.drain(..) {
|
||||
// write!(buf, ",{}:", &name[2..])?;
|
||||
// write!(buf, "{}", dioxus_html::event_bubbles(name) as u8)?;
|
||||
// }
|
||||
// }
|
||||
Segment::AttributeNodeMarker => {
|
||||
// first write the id
|
||||
write!(buf, "{}", self.dynamic_node_id)?;
|
||||
self.dynamic_node_id += 1;
|
||||
// then write any listeners
|
||||
for name in accumulated_listeners.drain(..) {
|
||||
write!(buf, ",{}:", &name[2..])?;
|
||||
write!(buf, "{}", dioxus_html::event_bubbles(name) as u8)?;
|
||||
}
|
||||
}
|
||||
|
||||
// Segment::RootNodeMarker => {
|
||||
// write!(buf, "{}", self.dynamic_node_id)?;
|
||||
// self.dynamic_node_id += 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Segment::RootNodeMarker => {
|
||||
write!(buf, "{}", self.dynamic_node_id)?;
|
||||
self.dynamic_node_id += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user