HTML validation: Remove obsolete attributes from <script>, <style>.

<script charset=…>, <script type=…>, and <style type=…> are “obsolete
but conforming” in HTML5.  They make the validator.nu output noisier
and real problems a little harder to find.

(type was required in HTML 4, which is not relevant to us.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2018-07-06 17:31:53 -04:00
committed by Tim Abbott
parent c28ab72124
commit f75c0e29f4
16 changed files with 19 additions and 20 deletions

View File

@@ -2,7 +2,7 @@
<p id="utctime" style="text-align: center;"></p>
<p id="localtime" style="text-align: center;"></p>
<script type="text/javascript">
<script>
var now = moment('{{ now }}');
$('#utctime')[0].innerHTML = moment.utc(now).format('YYYY-MM-DD HH:mm') + 'Z';
$('#localtime')[0].innerHTML = '(' + now.format('YYYY-MM-DD HH:mm ZZ') + ')';

View File

@@ -1,7 +1,7 @@
{% extends "zerver/base.html" %}
{% block page_params %}
<script type="text/javascript">
<script>
var page_params = {{ page_params|safe }};
</script>
{% endblock %}

View File

@@ -15,7 +15,7 @@ post to another view which executes in our code to produce the desired form.
<input type="hidden" value="{% if full_name %}{{ full_name }}{% endif %}" name="full_name"/>
</form>
<script type="text/javascript">
<script>
$(function () {
$("#register").submit();
});

View File

@@ -4,7 +4,7 @@
{# This is where we pitch the app and solicit signups. #}
{% block portico_content %}
<script type="text/javascript">
<script>
$(function () {
common.autofocus('#email');
});
@@ -102,7 +102,7 @@ $(function () {
</div>
</div>
<script type="text/javascript">
<script>
if (window.location.hash.substring(0, 1) === "#") {
document.email_form.action += window.location.hash;
}

View File

@@ -29,7 +29,7 @@
{% block customhead %}
{{ super() }}
<script type="text/javascript">
<script>
$(function() {
$("#resend_email_link").click(function () {
$('#resend_confirm').submit();

View File

@@ -4,7 +4,7 @@
{% block page_params %}
{# Insert parameters, which have been encoded with JSONEncoderForHTML. #}
<script type="text/javascript" nonce="{{ csp_nonce }}">
<script nonce="{{ csp_nonce }}">
{% autoescape off %}
var page_params = {{ page_params }};
{% endautoescape %}
@@ -20,7 +20,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<link href="/static/images/logo/apple-touch-icon-precomposed.png" rel="apple-touch-icon-precomposed">
<link id="emoji-spritesheet" href="/static/generated/emoji/{{ emojiset }}_sprite.css" rel="stylesheet" type="text/css">
<style type="text/css">
<style>
#css-loading {
background: white;
position: fixed;

View File

@@ -2,7 +2,7 @@
{% block customhead %}
<link id="emoji-spritesheet" href="/static/generated/emoji/google_sprite.css" rel="stylesheet" type="text/css">
<style type="text/css">
<style>
.portico-header {
padding-bottom: 0px;
padding-top: 10px;

View File

@@ -20,7 +20,7 @@
{% block page_params %}
{# blueslip needs page_params.debug_mode. Set it to false by default. #}
<script type="text/javascript">
<script>
var page_params = {debug_mode: false};
</script>
{% endblock %}

View File

@@ -4,7 +4,7 @@
{# This is where we pitch the app and solicit signups. #}
{% block portico_content %}
<script type="text/javascript">
<script>
$(function () {
common.autofocus('#email');
});

View File

@@ -64,7 +64,7 @@
</div>
</div>
<script type="text/javascript">
<script>
if (window.location.hash.substring(0, 1) === "#") {
/* We append the location.hash to the formaction so that URL can be
preserved after user is logged in. See this:

View File

@@ -59,7 +59,7 @@
<button data-dismiss="modal">Close</button>
</div>
</div>
<script type="text/javascript">
<script>
$('#toggle').change(function() {
if($('.email-text').css('display') == 'none') {
$(".email-text").each(function() {

View File

@@ -11,7 +11,7 @@
{% if password_auth_enabled %}
<script type="text/javascript">
<script>
{% if email %}
common.autofocus('#id_password');
{% else %}
@@ -168,7 +168,7 @@
</div>
</div>
</div>
<script type="text/javascript">
<script>
if (window.location.hash.substring(0, 1) === "#") {
/* We append the location.hash to the formaction so that URL can be
preserved after user is logged in. See this:

View File

@@ -209,7 +209,7 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser
</div>
</div>
<script type="text/javascript">
<script>
if ($("#id_team_name").length === 1) {
common.autofocus('#id_team_name');
} else if (($('#id_email').length === 1) && (!$('#id_email').attr('disabled'))) {

View File

@@ -39,7 +39,7 @@
</div>
</div>
<script type="text/javascript">
<script>
common.autofocus('#id_email');
</script>

View File

@@ -65,7 +65,7 @@
</div>
</form>
<script type="text/javascript">
<script>
common.autofocus('#id_new_password1');
</script>
{% else %}

View File

@@ -24,7 +24,6 @@ class MinifiedJSNode(Node):
else:
scripts = [settings.JS_SPECS[self.sourcefile]['output_filename']]
script_urls = [staticfiles_storage.url(script) for script in scripts]
script_tags = [('<script type="text/javascript" nonce="%s"'
' src="%s" charset="utf-8"></script>') % (self.csp_nonce, url)
script_tags = ['<script nonce="%s" src="%s"></script>' % (self.csp_nonce, url)
for url in script_urls]
return '\n'.join(script_tags)