mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6925 from jdufresne/text-js
Remove redundant type="text/javascript" from <script> elements
This commit is contained in:
commit
9b958f9525
2
doc/_themes/sphinx13/layout.html
vendored
2
doc/_themes/sphinx13/layout.html
vendored
@ -30,7 +30,7 @@
|
|||||||
.related { display: none; }
|
.related { display: none; }
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
// intelligent scrolling of the sidebar content
|
// intelligent scrolling of the sidebar content
|
||||||
$(window).scroll(function() {
|
$(window).scroll(function() {
|
||||||
var sb = $('.sphinxsidebarwrapper');
|
var sb = $('.sphinxsidebarwrapper');
|
||||||
|
@ -91,7 +91,7 @@ Google Analytics
|
|||||||
|
|
||||||
{%- block extrahead %}
|
{%- block extrahead %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
var _gaq = _gaq || [];
|
var _gaq = _gaq || [];
|
||||||
_gaq.push(['_setAccount', 'XXX account number XXX']);
|
_gaq.push(['_setAccount', 'XXX account number XXX']);
|
||||||
_gaq.push(['_trackPageview']);
|
_gaq.push(['_trackPageview']);
|
||||||
@ -103,7 +103,7 @@ Google Analytics
|
|||||||
<div class="footer">This page uses <a href="https://analytics.google.com/">
|
<div class="footer">This page uses <a href="https://analytics.google.com/">
|
||||||
Google Analytics</a> to collect statistics. You can disable it by blocking
|
Google Analytics</a> to collect statistics. You can disable it by blocking
|
||||||
the JavaScript coming from www.google-analytics.com.
|
the JavaScript coming from www.google-analytics.com.
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
var ga = document.createElement('script');
|
var ga = document.createElement('script');
|
||||||
ga.src = ('https:' == document.location.protocol ?
|
ga.src = ('https:' == document.location.protocol ?
|
||||||
@ -134,7 +134,6 @@ Google Search
|
|||||||
(function() {
|
(function() {
|
||||||
var cx = '......';
|
var cx = '......';
|
||||||
var gcse = document.createElement('script');
|
var gcse = document.createElement('script');
|
||||||
gcse.type = 'text/javascript';
|
|
||||||
gcse.async = true;
|
gcse.async = true;
|
||||||
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
|
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
|
||||||
var s = document.getElementsByTagName('script')[0];
|
var s = document.getElementsByTagName('script')[0];
|
||||||
|
@ -146,7 +146,6 @@ class JavaScript(str):
|
|||||||
self = str.__new__(cls, filename) # type: ignore
|
self = str.__new__(cls, filename) # type: ignore
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.attributes = attributes
|
self.attributes = attributes
|
||||||
self.attributes.setdefault('type', 'text/javascript')
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@ -1136,7 +1135,6 @@ def setup_js_tag_helper(app: Sphinx, pagename: str, templatexname: str,
|
|||||||
attrs.append('src="%s"' % pathto(js.filename, resource=True))
|
attrs.append('src="%s"' % pathto(js.filename, resource=True))
|
||||||
else:
|
else:
|
||||||
# str value (old styled)
|
# str value (old styled)
|
||||||
attrs.append('type="text/javascript"')
|
|
||||||
attrs.append('src="%s"' % pathto(js, resource=True))
|
attrs.append('src="%s"' % pathto(js, resource=True))
|
||||||
return '<script %s>%s</script>' % (' '.join(attrs), body)
|
return '<script %s>%s</script>' % (' '.join(attrs), body)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
{% block extrahead %}
|
{% block extrahead %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% if not embedded and collapse_index %}
|
{% if not embedded and collapse_index %}
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true;
|
DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true;
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{%- macro script() %}
|
{%- macro script() %}
|
||||||
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
|
<script id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
|
||||||
{%- for js in script_files %}
|
{%- for js in script_files %}
|
||||||
{{ js_tag(js) }}
|
{{ js_tag(js) }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
@ -11,16 +11,16 @@
|
|||||||
{% set title = _('Search') %}
|
{% set title = _('Search') %}
|
||||||
{%- block scripts %}
|
{%- block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript" src="{{ pathto('_static/searchtools.js', 1) }}"></script>
|
<script src="{{ pathto('_static/searchtools.js', 1) }}"></script>
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% block extrahead %}
|
{% block extrahead %}
|
||||||
<script type="text/javascript" src="{{ pathto('searchindex.js', 1) }}" defer></script>
|
<script src="{{ pathto('searchindex.js', 1) }}" defer></script>
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1 id="search-documentation">{{ _('Search') }}</h1>
|
<h1 id="search-documentation">{{ _('Search') }}</h1>
|
||||||
<div id="fallback" class="admonition warning">
|
<div id="fallback" class="admonition warning">
|
||||||
<script type="text/javascript">$('#fallback').hide();</script>
|
<script>$('#fallback').hide();</script>
|
||||||
<p>
|
<p>
|
||||||
{% trans %}Please activate JavaScript to enable the search
|
{% trans %}Please activate JavaScript to enable the search
|
||||||
functionality.{% endtrans %}
|
functionality.{% endtrans %}
|
||||||
|
@ -17,5 +17,5 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
<script>$('#searchbox').show(0);</script>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
{%- block scripts %}
|
{%- block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript" src="{{ pathto('_static/bizstyle.js', 1) }}"></script>
|
<script src="{{ pathto('_static/bizstyle.js', 1) }}"></script>
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
|
|
||||||
{# put the sidebar before the body #}
|
{# put the sidebar before the body #}
|
||||||
@ -26,6 +26,6 @@
|
|||||||
{%- block extrahead %}
|
{%- block extrahead %}
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
|
<script src="_static/css3-mediaqueries.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
|
@ -12,6 +12,6 @@
|
|||||||
{%- block scripts %}
|
{%- block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% if theme_collapsiblesidebar|tobool %}
|
{% if theme_collapsiblesidebar|tobool %}
|
||||||
<script type="text/javascript" src="{{ pathto('_static/sidebar.js', 1) }}"></script>
|
<script src="{{ pathto('_static/sidebar.js', 1) }}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{%- block scripts %}
|
{%- block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript" src="{{ pathto('_static/theme_extras.js', 1) }}"></script>
|
<script src="{{ pathto('_static/theme_extras.js', 1) }}"></script>
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{# do not display relbars #}
|
{# do not display relbars #}
|
||||||
{% block relbar1 %}{% endblock %}
|
{% block relbar1 %}{% endblock %}
|
||||||
|
@ -1216,8 +1216,8 @@ def test_html_assets(app):
|
|||||||
'href="https://example.com/custom.css" />' in content)
|
'href="https://example.com/custom.css" />' in content)
|
||||||
|
|
||||||
# html_js_files
|
# html_js_files
|
||||||
assert '<script type="text/javascript" src="_static/js/custom.js"></script>' in content
|
assert '<script src="_static/js/custom.js"></script>' in content
|
||||||
assert ('<script async="async" type="text/javascript" src="https://example.com/script.js">'
|
assert ('<script async="async" src="https://example.com/script.js">'
|
||||||
'</script>' in content)
|
'</script>' in content)
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ def test_mathjax_options(app, status, warning):
|
|||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
|
||||||
content = (app.outdir / 'index.html').text()
|
content = (app.outdir / 'index.html').text()
|
||||||
assert ('<script async="async" integrity="sha384-0123456789" type="text/javascript" '
|
assert ('<script async="async" integrity="sha384-0123456789" '
|
||||||
'src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?'
|
'src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?'
|
||||||
'config=TeX-AMS-MML_HTMLorMML"></script>' in content)
|
'config=TeX-AMS-MML_HTMLorMML"></script>' in content)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user