I am validating against HTML5 obtained through VS2010 SP1. I was under the impression that this simplification was possible:
<script type="text/javascript" src="foo.js">...</script>
to
<script src="foo.js">...</script>
In attempting this, I found:
<head id="Head1" runat="server">
<script src="../Scripts/MicrosoftAjax.js"></script>
</head>
yielded this:
Warning 1 Validation (HTML5): Element 'script' is missing required attribute 'type'.
Am I missing something? Is the Visual Studio XHTML5 validation more strict than the HTML5 doc necessitates?
Follow the steps: Launch Visual Studio 2012. Go to Tools > Options menu. When Options configuration screen is displayed, go to Text Editor > HTML > Validation.
Turn it on After installing SP1 you have to tell Visual Studio to start using the HTML5 schema. Go to Tools -> Options, and then select Text Editor -> HTML -> Validation. You should now be able to select HTML5 or XHTML5 as the target schema.
I resolved the issue by manually editing the schema file.
<xsd:element name="script">
...
<xsd:attribute name="type" vs:readonly="true" use="required">
...
html_5.xsd
in the VS schemas folder<Program Files>\Microsoft Visual Studio 10.0\Common7\Packages\schemas\html
xsd:element name="script"
tag) remove the use="required"
attribute.Seems like it's been submitted to Connect. The VS validator is being stricter than the HTML5
spec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With