DioxusLabs / DioxusLabs/dioxus

`rsx` macro should prevent any children in self-closing elements

Open
#2,397 0 comments 0 reactions 0 assignees View on GitHub
enhancement html rsx
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

## Feature Request

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

```html
Description

```

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

```rust
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.