[英]HTML5 Video Validation Error
I have the following markup, implemented using the VideoJS player (I can include the js too, if it becomes necessary): 我有以下标记,这些标记是使用VideoJS播放器实现的(如果需要,我也可以包含js):
<video id="example_video_1" class="video-js" width="736" height="352" controls="controls" autoplay="autoplay" loop="loop">
<source src="a/v/jt_homevid.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="a/v/jt_homevid.ogg" type='video/ogg; codecs="theora, vorbis"'>
<object id="flash_fallback_1" class="vjs-flash-fallback" width="736" height="352" type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
<param name="allowfullscreen" value="true" />
<param name="flashvars" value='config={"playlist":["<? echo $currurl; ?>/a/v/slide-1-joshtaerk-cdcover.jpg", {"url": "<? echo $currurl; ?>/a/v/jt_homevid.mp4","autoPlay":false,"autoBuffering":true}]}' />
<img src="a/v/slide-1-joshtaerk-cdcover.jpg" width="736" height="352" alt="Poster Image" title="No video playback capabilities." />
</object>
</video>
And this is currently failing HTML validation, with the following error message: 目前,此操作无法通过HTML验证,并显示以下错误消息:
Line 152, Column 82: Element source not allowed as child of element video in this context.
第152行,第82列:在这种情况下,元素源不允许作为元素视频的子元素。 (Suppressing further errors from this subtree.)…
(抑制此子树中的其他错误。)…
Contexts in which element source may be used:As a child of a media element, before any flow content or track elements.Content model for element video:If the element has a src attribute: zero or more track elements, then transparent, but with no media element descendants.If the element does not have a src attribute: zero or more source elements, then zero or more track elements, then transparent, but with no media element descendants.可以使用元素源的上下文:作为媒体元素的子元素,在任何流内容或轨道元素之前。元素视频的内容模型:如果元素具有src属性:零个或多个轨道元素,则透明,但具有没有媒体元素后代。如果元素没有src属性:零个或多个源元素,则零个或多个track元素,然后透明,但没有媒体元素后代。
I do understand that I maybe should not be trusting the W3C HTML5 validator at this point in it's development, but if I have miscoded, I would like to identify where, and how to prevent it in the future. 我确实知道,在开发过程中,此刻也许我不应该信任W3C HTML5验证程序,但是如果我输入了错误的代码,我想确定在哪里以及将来如何防止它。 Also, I'd like to be sure I am interpreting the error message correctly, which I think should happen along the way.
另外,我想确保我正确地解释了错误消息,我认为这应该一直发生。
I cannot see how I have deviated from the allowed contexts for this element. 我看不到如何偏离此元素的允许上下文。 It is a child of a media element (Specifically the
<video>
tag), it is before any 'flow content' I believe, because I cannot find the <source>
element listed as flow content on the W3C (at this link ), and I do not have any <track>
elements currently. 它是媒体元素(特别是
<video>
标记)的子元素,它位于任何“流内容”之前,因为我找不到W3C上作为流内容列出的<source>
元素(在此链接 ),而且我目前没有任何<track>
元素。
One thing I'm not certain about is the definition of 'then transparent' in the content model for the <video>
element. 我不确定的一件事是
<video>
元素的内容模型中的“然后透明”的定义。 From my understanding is that if elements inside the media elements are valid if they are also valid inside the parent of the media element (from this thread: Can I have multiple src attributes in an HTML5 <audio> element? Or an src attribute and a <source> element? ), and this is perhaps where I've misstepped, as I have the <video>
element inside a <div>
parent? 据我了解,如果media元素内的元素也有效,如果它们在media元素的父元素内也有效(从此线程来看: HTML5 <audio>元素中可以有多个src属性吗? <source>元素? ),也许这是我走错的地方,因为我在
<div>
父级中有<video>
元素?
Can anyone confirm this as my mistake, or whether I should ignore the validation message? 谁能确认这是我的错误,还是我应该忽略验证消息? If this is a mistake, how else should I be laying out my content?
如果这是一个错误,我应该如何布置我的内容? By styling the video element directly?
通过直接设置视频元素的样式?
Thanks in advance. 提前致谢。
Your understanding is correct, and this does look like a validator bug. 您的理解是正确的,这的确看起来像验证程序错误。
Validator.nu , which is based on the same validator engine as the W3C validator, but is likely to be a later version, passes the mark-up without any errors. Validator.nu与W3C验证器基于相同的验证器引擎,但很可能是更高版本,它传递标记而没有任何错误。
现在,此错误已在HTML5验证程序中修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.