You can clone with
HTTPS or Subversion.
Slowparse gets this error with the following html:
"The closing tag here doesn't pair with the opening tag here."
<!-- end scripts -->
Oops, html here:
<h1>My Popcorn Fun</h1>
<video id="video" width="400" height="300" preload controls="controls">
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>
<!-- end scripts -->
Oh, so that's actually because <source> is a void element... Like <img>, it doesn't need a closing tag. At the very least we should tell you that in our error message, since that current message is super confusing... in a more ideal world we might "let it slide" the same way that a browser does, though I'm not sure which is better pedagogically. What do you think?
no one said we shouldn't do both. in HTML5 it's not strictly speaking "wrong" to close a void element, just "highly discouraged" so we could let it slide with a suggestion "you don't need the closing element here, and future validators might flag an explicit closing element as an error"
Ok, I think for now I'm going to create a new helpful error message type for void element closing tags, since they don't validate, and in the future we can add a "be nice and just provide warnings for non-fatal errors" option that tones down the hardcore-ness. Sound ok?
Added CLOSE_TAG_FOR_VOID_ELEMENT error type, which fixes #20.
that validator confuses me greatly. XHTML doesn't exist anymore, so what is it validating? if we're going strict html5, we probably want to use w3's validator as reference instead.
Oh, sure, we can use the w3c validator. For some reason Tantek's book recommends the one I linked to, and at least for this particular case, both validators barf on closing tags for void elements.
Er, that said, I am personally conflicted about whether we should go strict HTML5. I suppose in the end it should really be about making writing HTML/CSS easy and fun for the user rather than confusing and error-prone... Helping them with mismatched tags generally aids that but being pedantic doesn't... So I guess we should implement that "warn me about non-fatal errors but don't explode when you run into them" feature sooner rather than later.