Skip to content
This repository

Problem with <video> and <source> tags #20

Closed
k88hudson opened this Issue · 7 comments

3 participants

Kate Hudson Atul Varma Mike Kamermans
Kate Hudson
Collaborator

Slowparse gets this error with the following html:
"The closing tag here doesn't pair with the opening tag here."


My Popcorn Fun















<!-- end scripts -->

Kate Hudson
Collaborator

Oops, html here:

  <header>
    <h1>My Popcorn Fun</h1>
  </header>
  <div role="main">
    <div id="video-container">
      <video id="video" width="400" height="300" preload controls="controls">
        <source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.mp4"></source>
        <source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.ogv"></source>
        <source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.webm"></source>
      </video>
    </div>
  </div>
  <footer>

  </footer>

  <script src="js/external.popcorn-js/popcorn.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  <script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>

  <script src="js/script.js"></script>
  <!-- end scripts -->
Atul Varma
Collaborator

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?

Mike Kamermans
Collaborator
Pomax commented

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"

Atul Varma
Collaborator

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?

Mike Kamermans
Collaborator
Pomax commented

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.

Atul Varma
Collaborator

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.

Atul Varma
Collaborator

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.

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.