Skip to content

Conversation

@sirreal
Copy link
Member

@sirreal sirreal commented Dec 23, 2025

Trac ticket: https://core.trac.wordpress.org/ticket/64442

HTML5 script theme support is not worth considering today, themes do not control and are not concerned with HTML5 script rendering. Data suggests that the overwhelming majority of page views are HTML5, not XHTML (props @westonruter) and theme scripts are not broken regardless of their declared support.

This declared support has two impacts, it will add a type attribute to script tags and it will add CDATA wrappers.

This is an inline script without declared HTML5 script support:

<script type="text/javascript" async="async">
/* <![CDATA[ */
"script contents";
/* ]]> */
</script>

And the same script with support:

<script async>
"script contents";
</script>

#64428 proposes removal of the type attribute on scripts and styles. This ticket focuses on all aspects of theme support for HTML5 scripts. Declaring HTML5 script support can be deprecated, and the CDATA and type attribute removed.

The CDATA wrappers are redundant for JavaScript in HTML5 and are harmful where script tags do not contain JavaScript (#60320). The HTML5 checks add needless complication to code.

The redundant attribute and CDATA wrappers are only relevant for XHTML. This requires the appropriate Content-Type: application/xhtml+xml HTTP header to be sent, something that themes do not appear to do. The HTTP content type header is more closely tied to server configuration (PHP defaults to text/html) than theme support. Themes do not really know whether a page will be served and interpreted as XHTML.

This is part of #59883.
Related to #64428 and #64419.

Related to #10658.

To do:


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@sirreal sirreal force-pushed the 64442/deprecate-html5-script-theme-support branch from 2ab91e9 to 6990551 Compare December 26, 2025 13:39
@sirreal sirreal marked this pull request as ready for review December 29, 2025 08:34
@sirreal sirreal requested a review from westonruter December 29, 2025 08:34
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jonsurrell.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@sirreal sirreal requested review from dmsnell and westonruter and removed request for westonruter December 29, 2025 08:34
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So great to remove this tech debt!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants