Self-closing tags on void elements aren't accepted #23

toolness opened this Issue Apr 25, 2012 · 0 comments


None yet
1 participant

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.

@toolness toolness closed this in 83034bf Apr 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment