Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsx macro should prevent any children in self-closing elements #2397

Open
mrgzi opened this issue May 7, 2024 · 0 comments
Open

rsx macro should prevent any children in self-closing elements #2397

mrgzi opened this issue May 7, 2024 · 0 comments
Labels
enhancement New feature or request html Related to the html crate rsx Related to rsx or the dioxus-rsx crate

Comments

@mrgzi
Copy link

mrgzi commented May 7, 2024

Feature Request

HTML includes several self-closing elements that are not designed to contain any child elements. Examples of such elements are:

<img src="image.jpg" alt="Description" />
<input type="text" name="username" />

Currently, the rsx! macro in Dioxus allows content to be placed inside these self-closing elements:

pub fn component() -> Element {
    rsx! {
        img {"This is an image"}
    }
}

Implement Suggestion

The rsx! macro should produce an error if any content is nested inside self-closing elements. This would align the behavior of the macro with standard HTML practices and prevent potential rendering issues.

@mrgzi mrgzi changed the title rsx! macro should prevent any children in self-closing elements rsx macro should prevent any children in self-closing elements May 7, 2024
@ealmloff ealmloff added enhancement New feature or request html Related to the html crate rsx Related to rsx or the dioxus-rsx crate labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request html Related to the html crate rsx Related to rsx or the dioxus-rsx crate
Projects
None yet
Development

No branches or pull requests

2 participants