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

SVG void elements don't have a slash #242

Closed
taronull opened this issue Oct 19, 2024 · 1 comment · Fixed by #243 or #244
Closed

SVG void elements don't have a slash #242

taronull opened this issue Oct 19, 2024 · 1 comment · Fixed by #243 or #244

Comments

@taronull
Copy link

Temple is amazing so far. Thanks for this library.

Describe the bug
SVG void elements nest siblings without a self-closing slash

To Reproduce
Steps to reproduce the behavior:

def test do
  temple do
    rect width: "256"
    circle cx: "128"
  end
end
# "<rect width=\"256\">\n<circle cx=\"128\">\n"

In browser, unintended closing tag is added

<!-- -->
<rect width="256">
  <circle cx="128">
</rect>

Expected behavior
A clear and concise description of what you expected to happen.

rect width: "256"
circle cx: "128"

Should result in

<!-- In browser, unintended closing tag is added -->
<rect width="256" />
<circle cx="128" />

Should equal

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS Monterey 12.7.6
  • Temple Version: 13
  • Elixir Version: 1.17
  • Erlang Version: 27

Additional context
Add any other context about the problem here.

Current workaround is /: true attribute.

I think Temple could add a slash to all self-closing tags because HTML has no problem with them.

@mhanberg
Copy link
Owner

It looks like I'm the html spec, all foreign elements (svg and math ml) have to be self closing, probably an easy fix here.

mhanberg added a commit that referenced this issue Oct 20, 2024
Closes #242

fix: add mathml tags to formatter
mhanberg added a commit that referenced this issue Oct 20, 2024
Closes #242

fix: add mathml tags to formatter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants