Skip to content

[FEATURE]: skip type="text/javascript" attribute in <script> tag of HTML output #5449

Closed

Description

@hannob

Description

plotly.py's HTML output of the write_html() function currently adds a type attribute to the script tag, which is discouraged and causes a warning in the HTML validator:
<script type="text/javascript">

Why should this feature be added?

Standard Javascript code is the default for the <script> tag in HTML, adding a type attribute to declare that default is unnecessary.
The current HTML5 spec explicitly discourages setting it:
"Omitting the attribute, setting it to the empty string, or setting it to a JavaScript MIME type essence match means that the script is a classic script, to be interpreted according to the JavaScript Script top-level production. Authors should omit the type attribute instead of redundantly setting it."

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

Activity

  1. robertclaus commented on Dec 17, 2025

    @robertclaus

    @hannob this is a great callout. This might be a very simple change in the codebase if you are interested in opening a PR for it.

  2. hannob commented on Dec 22, 2025

    @hannob
    ContributorAuthor

    I tried a PR here: #5454

    CI first failed due to a ruff formatting issue, which I fixed, now it fails with some doc issue, not sure why...

  3. lalithu commented on Jan 12, 2026

    @lalithu

    Hi! I’m new to contributing but happy to help debug the remaining CI/doc failure. I’ll try to reproduce it locally and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2considered for next cyclefeaturesomething newgood first issuesuitable for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions