Script Loader: Only emit CDATA wrapper comments in `wp_get_inline_script_tag()` for JavaScript.
This avoids erroneously adding CDATA wrapper comments for non-JavaScript scripts, including those for JSON such as the `importmap` for script modules in #56313. Props westonruter, flixos90, mukesh27, dmsnell. See #56313. Fixes #60320. Built from https://develop.svn.wordpress.org/trunk@57341 git-svn-id: http://core.svn.wordpress.org/trunk@56847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7343352744
commit
a3abf9c89f
wp-includes
|
@ -2879,7 +2879,17 @@ function wp_get_inline_script_tag( $javascript, $attributes = array() ) {
|
|||
*
|
||||
* @see https://www.w3.org/TR/xhtml1/#h-4.8
|
||||
*/
|
||||
if ( ! $is_html5 ) {
|
||||
if (
|
||||
! $is_html5 &&
|
||||
(
|
||||
! isset( $attributes['type'] ) ||
|
||||
'module' === $attributes['type'] ||
|
||||
str_contains( $attributes['type'], 'javascript' ) ||
|
||||
str_contains( $attributes['type'], 'ecmascript' ) ||
|
||||
str_contains( $attributes['type'], 'jscript' ) ||
|
||||
str_contains( $attributes['type'], 'livescript' )
|
||||
)
|
||||
) {
|
||||
/*
|
||||
* If the string `]]>` exists within the JavaScript it would break
|
||||
* out of any wrapping CDATA section added here, so to start, it's
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5-alpha-57340';
|
||||
$wp_version = '6.5-alpha-57341';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue