visual-studio-2010 – Visual Studio 2010 MVC 3中的HTML 5验证错误

我很困惑,为什么Visual Studio 2010在我的源标记上给出了以下验证错误.

Validation (HTML5): Element ‘source’ cannot be nested within element
‘audio’

下面是我在cshtml视图中的代码:

@{
    ViewBag.Title = "Audio";
    string audioURL = Url.Content("~/Content/Audio/untitled.mp3");
}

<div>
  <audio id ="myAudio" controls preload="auto">  
      <source src="@audioURL" type="audio/mpeg" />   
  </audio> 
</div>

我一直在四处寻找,我在标签中看到了很多对src属性的引用.但这不能回答我的问题,为什么验证错误?它实际上是否正确,但VS2010认为它是错误的,或者它是否真的不正确,如果是这样,为什么它不正确?

最佳答案
我发现了这个问题,它是Visual Studio 2010中的一个错误,通过他们的文档我找到了这个链接
Web Standards Update for Visual Studio 2010 SP1

这就是他们对这个问题的看法,更新应该解决它.

The HTML 5 support included in SP1 added intellisense and validation for a lot of new elements such as the video and source elements. However, there were bugs and one of them were the error you would see when adding source elements inside video elements. This is being fixed by this update so you now also get intellisense for the source element.

转载注明原文:visual-studio-2010 – Visual Studio 2010 MVC 3中的HTML 5验证错误 - 代码日志