GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
The HTML5 Validator is okay with self-closing tags on void elements (e.g. <br/>), but not on normal elements (e.g. <p/>). In fact, it's almost definitely going to result in wonky code when used on non-void elements, because many browsers interpret it as an opening tag instead of an opening tag immediately followed by a closing tag--I once spent hours debugging a <script src="blah.js"/> only to find out that the script was never being loaded, because I self-closed the tag instead of providing a </script>.
So, I think we should do what the HTML5 validator does and accept self-closing tags on void elements, but not on non-void elements. We could potentially provide a helpful error when we run into self-closed non-void elements, though.