Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<video> issue with </source> tags #9

Closed
stevenle opened this issue Feb 24, 2012 · 2 comments
Closed

<video> issue with </source> tags #9

stevenle opened this issue Feb 24, 2012 · 2 comments

Comments

@stevenle
Copy link
Contributor

Looks like there's an issue when users use <source></source> and multiple <source> tags inside a

Input:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Video</title>
  </head>
  <body>
     <video src="ogg">
       <source class="webm" src="demo.webm" type="video/webm"></source>
       <source class="mp4" src="demo.mp4" type="video/mp4"></source>
     </video>
  </body>
</html>

Errors:

line 8 column 6 - Warning: replacing unexpected source by </source>
line 10 column 60 - Warning: discarding unexpected </source>
line 11 column 6 - Warning: discarding unexpected </video>
Info: Document content looks like HTML5
3 warnings, 0 errors were found!

Output: (notice the second <source> tag appears outside of the <video> tag)

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for Linux from https://github.com/w3c/tidy-html5">
<meta charset="utf-8">
<title>Video</title>
</head>
<body>
<video src="ogg"><source class="webm" src="demo.webm" type=
"video/webm"></video> <source class="mp4" src="demo.mp4" type=
"video/mp4">
</body>
</html>
@sideshowbarker
Copy link
Contributor

This is expected behavior because is an empty element. It's not allowed to have an end tag.

Also you example is invalid because you can't have both the src attribute on video and also a source child. Need to be one or other but not both.

@stevenle
Copy link
Contributor Author

I was thinking that even though the markup isn't valid, tidy would automatically try to fix it for the user. The warning messages ("Warning: replacing unexpected source by </source>" and "line 10 column 44 - Warning: discarding unexpected </source>"), seems to indicate it's trying but failing.

Even when I use the example from w3schools but insert invalid closing tags, this behavior appears:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Video</title>
  </head>
  <body>
  <video width="320" height="240" controls="controls">
  <source src="movie.mp4" type="video/mp4"></source>
  <source src="movie.ogg" type="video/ogg"></source>
  Your browser does not support the video tag.
</video>
  </body>
</html>

Gets tided to:

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 (experimental) for Linux https://github.com/w3c/tidy-html5/tree/f2825b9">
<meta charset="utf-8">
<title>Video</title>
</head>
<body>
<video width="320" height="240" controls="controls"><source src=
"movie.mp4" type="video/mp4"></video> <source src="movie.ogg" type=
"video/ogg"> Your browser does not support the video tag.
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants