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

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

Open
akazukin5151 opened this issue May 7, 2023 · 0 comments
Open

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

akazukin5151 opened this issue May 7, 2023 · 0 comments

Comments

@akazukin5151
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant