allow many attributes to be attached to one element

This commit is contained in:
Evan Almloff committed 2023-09-20 16:02:04 -05:00
1 parent dc446b5e5b
commit fc8c25280a
12 files changed
+289 -96

No files matched your search

+4 -3
View File
@@ -1,7 +1,7 @@
#![cfg(not(miri))]
use dioxus::prelude::Props;
use dioxus_core::*;
use dioxus_core::{MountedAttribute, *};
use std::{cell::Cell, collections::HashSet};
fn random_ns() -> Option<&'static str> {
@@ -205,7 +205,7 @@ fn create_random_dynamic_node(cx: &ScopeState, depth: usize) -> DynamicNode {
}
}
fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
fn create_random_dynamic_attr(cx: &ScopeState) -> MountedAttribute {
let value = match rand::random::<u8>() % 7 {
0 => AttributeValue::Text(Box::leak(
format!("{}", rand::random::<usize>()).into_boxed_str(),
@@ -217,7 +217,7 @@ fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
5 => AttributeValue::None,
6 => {
let value = cx.listener(|e: Event<String>| println!("{:?}", e));
return Attribute::new("ondata", value, None, false);
return Attribute::new("ondata", value, None, false).into();
}
_ => unreachable!(),
};
@@ -227,6 +227,7 @@ fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
random_ns(),
rand::random(),
)
.into()
}
static mut TEMPLATE_COUNT: usize = 0;