axohtml
axohtml copied to clipboard
Header elements (h1-h6) cannot be placed inside <summary>
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
let x: DOMTree<String> = html! {
<summary>
<h4>"test"</h4>
</summary>
};
error[E0277]: the trait bound `h4<_>: axohtml::elements::PhrasingContent<_>` is not satisfied
--> src/main.rs:9:30
|
9 | let x: DOMTree<String> = html! {
| ______________________________^
10 | | <summary>
11 | | <h4>"test"</h4>
12 | | </summary>
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