You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Rust is a strongly typed language, it seems sensible to check types in HTML attribute values as well. Currently, rsx macro allows the following usage:
Instead of forcing developers to use strongly typed HTML, we can provide two options:
Comprehensive Type Definitions: Attributes should have type definitions that can include primitive data types, enums, and custom structs, depending on the attribute's expected values.
String Literal Validation: When attributes are specified using string literals, the rsx macro should validate these strings against the expected data types.
Examples;
pubfncomponent() -> Element{rsx!{
input {
r#type: InputType::Email,
maxlength: 10}
input {
r#type: "email"
maxlength: "10"}
input {
r#type: "emaaill"// `rsx` should show an error: invalid input type
maxlength: "10"}}}
The text was updated successfully, but these errors were encountered:
I have some concerns about the binary size impact of typed HTML in WASM. One of the largest pieces of dioxus-web today is just converting a typed enum key in events to and from a string. Each part of typed HTML would need similar logic which may have a large binary size.
Feature Request
Since Rust is a strongly typed language, it seems sensible to check types in HTML attribute values as well. Currently,
rsx
macro allows the following usage:However, the
maxlength
attribute should actually be an integer:Implement Suggestion
Instead of forcing developers to use strongly typed HTML, we can provide two options:
rsx
macro should validate these strings against the expected data types.Examples;
The text was updated successfully, but these errors were encountered: