[wp-trac] [WordPress Trac] #64442: Deprecate and remove HTML5 script theme support
WordPress Trac
noreply at wordpress.org
Fri Dec 26 14:47:18 UTC 2025
#64442: Deprecate and remove HTML5 script theme support
-------------------------------------------------+-------------------------
Reporter: jonsurrell | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0
Component: Script Loader | Version:
Severity: normal | Resolution:
Keywords: 2nd-opinion has-patch has-unit- | Focuses: javascript
tests |
-------------------------------------------------+-------------------------
Description changed by jonsurrell:
Old description:
> HTML5 script ''theme support'' is not worth considering today, themes do
> not control and are not concerned with HTML5 script rendering.
> [https://github.com/GoogleChromeLabs/wpp-research/pull/74 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:
>
> {{{#!xml
> <script type="text/javascript">
> /* <![CDATA[ */
> "script contents";
> /* ]]> */
> </script>
> }}}
>
> And the same script with support:
>
> {{{#!xml
> <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,
> [https://www.wpdirectory.net/search/01KD2YQR0PBPKMCRJKAT8BT760 something
> that themes do not appear to do.] The HTTP content type header is more
> closely tied to server configuration
> ([https://www.php.net/manual/en/ini.core.php#ini.default-mimetype 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.
New description:
HTML5 script ''theme support'' is not worth considering today, themes do
not control and are not concerned with HTML5 script rendering.
[https://github.com/GoogleChromeLabs/wpp-research/pull/74 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:
{{{#!xml
<script type="text/javascript" async="async">
/* <![CDATA[ */
"script contents";
/* ]]> */
</script>
}}}
And the same script with support:
{{{#!xml
<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,
[https://www.wpdirectory.net/search/01KD2YQR0PBPKMCRJKAT8BT760 something
that themes do not appear to do.] The HTTP content type header is more
closely tied to server configuration
([https://www.php.net/manual/en/ini.core.php#ini.default-mimetype 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.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64442#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list