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

<img> doesn't need </img> #1

Closed
benkasminbullock opened this issue Mar 23, 2021 · 2 comments
Closed

<img> doesn't need </img> #1

benkasminbullock opened this issue Mar 23, 2021 · 2 comments

Comments

@benkasminbullock
Copy link

I tried your project:

package main

import (
	"fmt"
	"github.com/stevelacy/daz"
)

func main() {
	img := daz.H("img", daz.Attr{"src": "https://www.sljfaq.org/images/birthdays.png"})
	body := daz.H("body", img)
	fmt.Printf("%s", daz.H("html", daz.H("head"), body)())
}

The output looks like this:

<html><head></head><body><img src='https://www.sljfaq.org/images/birthdays.png'></img></body></html>

You don't need </img> after the <img>.

The W3 validator gives an error on adding this input, so I would assume it's an error to add this. I looked at the source code but didn't see a way to switch that off.

Some other things which don't need an ending tag are

var noCloseTags = []string{
        "area",
        "br",
        "hr",
        "image",
        "input",
        "img",
        "link",
        "meta",
}
@stephenlacy
Copy link
Owner

@benkasminbullock Thanks for reporting! Will add support for non-closing HTML tags

@stephenlacy
Copy link
Owner

Thanks, fixed!

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

2 participants