axodotdev / axodotdev/axohtml

Header elements (h1-h6) cannot be placed inside <summary>

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
119
Forks
10
PR merge metrics
No merged PRs in 30d

Description

The spec does say it's for Phrasing contents (which excludes header elements), but then allows them anyway.

> Content model:
> Phrasing content, optionally intermixed with heading content.

https://html.spec.whatwg.org/multipage/interactive-elements.html#the-summary-element

https://stackoverflow.com/questions/41227862/is-it-semantically-correct-to-use-h2-tag-inside-summary-tag

So the compile error for this code, does not follow the spec

```rust
let x: DOMTree = html! {

"test"



};
```

```rust
error[E0277]: the trait bound `h4<_>: axohtml::elements::PhrasingContent<_>` is not satisfied
--> src/main.rs:9:30
|
9 | let x: DOMTree = html! {
| ______________________________^
10 | |
11 | |

"test"


12 | |
13 | | };
| |_____^ the trait `axohtml::elements::PhrasingContent<_>` is not implemented for `h4<_>`
|
```

This feels gnarly to carve out an exception in our type system, so I understand if this isn't high priority. It's not high priority for me either

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.