feat: namespaced attributes

this commit adds namespaced attributes. This lets us support attribute groups, and thus, inline styles.

This namespaced attribute stuff is only available for styles at the moment, though it theoretically could be enabled for any other attributes.
This commit is contained in:
Jonathan Kelley committed 2021-07-06 23:04:33 -04:00
1 parent a4bf3d9862
commit 22e659c2bd
18 files changed
+612 -3129

No files matched your search

+6 -2
View File
@@ -2,7 +2,9 @@
//!
//! The example from the README.md
use dioxus::prelude::*;
use dioxus::{events::on::MouseEvent, prelude::*};
use dioxus_html_namespace::{button, div, h1};
fn main() {
dioxus::web::launch(Example)
}
@@ -10,9 +12,11 @@ fn main() {
fn Example(cx: Context<()>) -> VNode {
let name = use_state(&cx, || "..?");
let handler = move |e: MouseEvent| e.cl;
cx.render(rsx! {
h1 { "Hello, {name}" }
button { "?", onclick: move |_| name.set("world!")}
button { "?", onclick: move |event| name.set("world!")}
button { "?", onclick: move |_| name.set("Dioxus 🎉")}
})
}