Skip to content


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

toolness opened this Issue · 0 comments

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 added a commit that closed this issue
@toolness toolness Parsing of self-closing tags for void elements now works. Added SELF_…
…CLOSING_NON_VOID_ELEMENT error for the other tags. This fixes #23.
@toolness toolness closed this in 83034bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.