Require valid type for <script>
element
- Rule ID:
- script-type
- Category:
- HTML Syntax and concepts
- Standards:
- HTML5
The HTML5 standard encourages omitting the type
attribute when the script is a JavaScript resource and only use it to specify module
or other non-javascript MIME types.
Rule details
Examples of incorrect code for this rule:
<script type=""></script>
<script type="text/javascript"></script>
<script type="application/javascript"></script>
Examples of correct code for this rule:
<script></script>
<script type="module"></script>
<script type="text/plain"></script>
<script type="text/x-custom"></script>