Skip to content

Commit 4e953f3

Browse files
authored
Merge pull request #5454 from hannob-forks/unneededtype
Remove unneeded `type="text/javascript"` attribute from `<style>` tag
2 parents 55597ab + cf5ac9f commit 4e953f3

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

plotly/io/_base_renderers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def activate(self):
273273

274274
if self.connected:
275275
script = """\
276-
<script type="text/javascript">
276+
<script>
277277
{win_config}
278278
{mathjax_config}
279279
</script>
@@ -288,7 +288,7 @@ def activate(self):
288288
# If not connected then we embed a copy of the plotly.js
289289
# library in the notebook
290290
script = """\
291-
<script type="text/javascript">
291+
<script>
292292
{win_config}
293293
{mathjax_config}
294294
</script>

plotly/io/_html.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ def _generate_sri_hash(content):
2222
# Build script to set global PlotlyConfig object. This must execute before
2323
# plotly.js is loaded.
2424
_window_plotly_config = """\
25-
<script type="text/javascript">\
25+
<script>\
2626
window.PlotlyConfig = {MathJaxConfig: 'local'};\
2727
</script>"""
2828

2929
_mathjax_config = """\
30-
<script type="text/javascript">\
30+
<script>\
3131
if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\
3232
</script>"""
3333

@@ -282,7 +282,7 @@ def to_html(
282282
elif include_plotlyjs:
283283
load_plotlyjs = """\
284284
{win_config}
285-
<script type="text/javascript">{plotlyjs}</script>\
285+
<script>{plotlyjs}</script>\
286286
""".format(win_config=_window_plotly_config, plotlyjs=get_plotlyjs())
287287

288288
# ## Handle loading/initializing MathJax ##
@@ -323,7 +323,7 @@ def to_html(
323323
{load_plotlyjs}\
324324
<div id="{id}" class="plotly-graph-div" \
325325
style="height:{height}; width:{width};"></div>\
326-
<script type="text/javascript">\
326+
<script>\
327327
window.PLOTLYENV=window.PLOTLYENV || {{}};{base_url_line}\
328328
{script};\
329329
</script>\

plotly/offline/offline.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def get_plotlyjs():
7070
>>> html = '''
7171
... <html>
7272
... <head>
73-
... <script type="text/javascript">{plotlyjs}</script>
73+
... <script>{plotlyjs}</script>
7474
... </head>
7575
... <body>
7676
... {div1}
@@ -89,7 +89,7 @@ def get_plotlyjs():
8989

9090
def _build_resize_script(plotdivid, plotly_root="Plotly"):
9191
resize_script = (
92-
'<script type="text/javascript">'
92+
"<script>"
9393
'window.addEventListener("resize", function(){{'
9494
'if (document.getElementById("{id}")) {{'
9595
'{plotly_root}.Plots.resize(document.getElementById("{id}"));'
@@ -177,12 +177,12 @@ def _get_jconfig(config=None):
177177
# Build script to set global PlotlyConfig object. This must execute before
178178
# plotly.js is loaded.
179179
_window_plotly_config = """\
180-
<script type="text/javascript">\
180+
<script>\
181181
window.PlotlyConfig = {MathJaxConfig: 'local'};\
182182
</script>"""
183183

184184
_mathjax_config = """\
185-
<script type="text/javascript">\
185+
<script>\
186186
if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\
187187
</script>"""
188188

tests/test_core/test_offline/test_offline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
PLOTLYJS = plotly.offline.get_plotlyjs()
3636

3737
plotly_config_script = """\
38-
<script type="text/javascript">\
38+
<script>\
3939
window.PlotlyConfig = {MathJaxConfig: 'local'};</script>"""
4040

4141
cdn_script = '<script charset="utf-8" src="{cdn_url}" integrity="{js_hash}" crossorigin="anonymous"></script>'.format(

tests/test_io/test_renderers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,15 @@ def test_repr_html(renderer):
306306
sri_hash = _generate_sri_hash(plotlyjs_content)
307307

308308
template = (
309-
'<div> <script type="text/javascript">'
309+
"<div> <script>"
310310
"window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n "
311311
'<script charset="utf-8" src="'
312312
+ plotly_cdn_url()
313313
+ '" integrity="'
314314
+ sri_hash
315315
+ '" crossorigin="anonymous"></script> '
316316
'<div id="cd462b94-79ce-42a2-887f-2650a761a144" class="plotly-graph-div" '
317-
'style="height:100%; width:100%;"></div> <script type="text/javascript">'
317+
'style="height:100%; width:100%;"></div> <script>'
318318
" window.PLOTLYENV=window.PLOTLYENV || {};"
319319
' if (document.getElementById("cd462b94-79ce-42a2-887f-2650a761a144"))'
320320
' { Plotly.newPlot( "cd462b94-79ce-42a2-887f-2650a761a144",'

0 commit comments

Comments
 (0)