Skip to content

Commit

Permalink
Remove discouraged type="text/javascript" from scripts (#1140)
Browse files Browse the repository at this point in the history
type="text/javascript" is unnecessary and even discouraged by the
specification: “Authors should omit the type attribute instead of
redundantly setting it.”

https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type

It causes the validator to raise warnings, too.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Loading branch information
andersk committed May 1, 2021
1 parent 2026bb6 commit 671703c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions sphinx_rtd_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
{%- if not embedded %}
{# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #}
{%- if sphinx_version >= "1.8.0" -%}
<script type="text/javascript" id="documentation_options" data-url_root="{{ url_root }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
<script id="documentation_options" data-url_root="{{ url_root }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
{%- for scriptfile in script_files %}
{{ js_tag(scriptfile) }}
{%- endfor %}
{%- else %}
<script type="text/javascript">
<script>
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'{{ url_root }}',
VERSION:'{{ release|e }}',
Expand All @@ -74,10 +74,10 @@
};
</script>
{%- for scriptfile in script_files %}
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
<script src="{{ pathto(scriptfile, 1) }}"></script>
{%- endfor %}
{%- endif %}
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
<script src="{{ pathto('_static/js/theme.js', 1) }}"></script>

{#- OPENSEARCH #}
{%- if use_opensearch %}
Expand Down Expand Up @@ -209,7 +209,7 @@
</div>
{% include "versions.html" -%}

<script type="text/javascript">
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable({{ 'true' if theme_sticky_navigation|tobool else 'false' }});
});
Expand Down
8 changes: 4 additions & 4 deletions sphinx_rtd_theme/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
{% set display_vcs_links = False %}
{%- block scripts %}
{{ super() }}
<script type="text/javascript" src="{{ pathto('_static/searchtools.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/language_data.js', 1) }}"></script>
<script src="{{ pathto('_static/searchtools.js', 1) }}"></script>
<script src="{{ pathto('_static/language_data.js', 1) }}"></script>
{%- endblock %}
{% block footer %}
<script type="text/javascript">
<script>
jQuery(function() { Search.loadIndex("{{ pathto('searchindex.js', 1) }}"); });
</script>
{# this is used when loading the search index using $.ajax fails,
such as on Chrome for documents on localhost #}
<script type="text/javascript" id="searchindexloader"></script>
<script id="searchindexloader"></script>
{{ super() }}
{% endblock %}
{% block body %}
Expand Down

0 comments on commit 671703c

Please sign in to comment.