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">
/* <![CDATA[ */
"script contents";
/* ]]> */
</script>

And the same script with support:

<script>
"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.

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.

1 participant