From 8d74eb232bccf04c717fb1741dc19c56ea0daa35 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Tue, 13 Jan 2026 16:17:17 +0100 Subject: [PATCH 1/6] Remove stale html5 script tag comment. Comment is obsolete as of r61415. --- src/wp-includes/script-loader.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 366f8f93667e7..dd7dabd9eaa3d 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2840,10 +2840,6 @@ function wp_enqueue_editor_format_library_assets() { function wp_sanitize_script_attributes( $attributes ) { $attributes_string = ''; - /* - * If HTML5 script tag is supported, only the attribute name is added - * to $attributes_string for entries with a boolean value, and that are true. - */ foreach ( $attributes as $attribute_name => $attribute_value ) { if ( is_bool( $attribute_value ) ) { if ( $attribute_value ) { From 7bf540116e30a7189d15406eebe5e1f18215ee09 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Tue, 13 Jan 2026 17:40:36 +0100 Subject: [PATCH 2/6] Remove obsolete html5 references from scripts tests --- tests/phpunit/tests/dependencies/scripts.php | 16 --------- .../tests/dependencies/wpLocalizeScript.php | 2 -- .../tests/dependencies/wpScriptTag.php | 36 ++----------------- 3 files changed, 2 insertions(+), 52 deletions(-) diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index 8cca03010cad2..e3c112e0e6044 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -1878,22 +1878,6 @@ public function test_concatenate_with_blocking_script_before_and_after_script_wi $this->assertEqualHTML( $expected, $print_scripts, '', 'Scripts are being incorrectly concatenated when a main script is registered as deferred after other blocking scripts are registered. Deferred scripts should not be part of the script concat loader query string. ' ); } - /** - * @ticket 42804 - */ - public function test_wp_enqueue_script_with_html5_support_does_not_contain_type_attribute() { - global $wp_version; - - $GLOBALS['wp_scripts'] = new WP_Scripts(); - $GLOBALS['wp_scripts']->default_version = get_bloginfo( 'version' ); - - wp_enqueue_script( 'empty-deps-no-version', 'example.com' ); - - $expected = "\n"; - - $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); - } - /** * Test the different protocol references in wp_enqueue_script * diff --git a/tests/phpunit/tests/dependencies/wpLocalizeScript.php b/tests/phpunit/tests/dependencies/wpLocalizeScript.php index 7ec8604d40b87..6ddf22f1df858 100644 --- a/tests/phpunit/tests/dependencies/wpLocalizeScript.php +++ b/tests/phpunit/tests/dependencies/wpLocalizeScript.php @@ -46,8 +46,6 @@ public function test_wp_localize_script_works_before_enqueue_script() { * @covers ::wp_localize_script */ public function test_wp_localize_script_outputs_safe_json() { - add_theme_support( 'html5', array( 'script' ) ); - $path = '/test.js'; $base_url = site_url( $path ); diff --git a/tests/phpunit/tests/dependencies/wpScriptTag.php b/tests/phpunit/tests/dependencies/wpScriptTag.php index c06a86b2db57f..75d9c02899185 100644 --- a/tests/phpunit/tests/dependencies/wpScriptTag.php +++ b/tests/phpunit/tests/dependencies/wpScriptTag.php @@ -9,10 +9,8 @@ class Tests_Dependencies_wpScriptTag extends WP_UnitTestCase { public function get_script_tag_type_set() { - add_theme_support( 'html5', array( 'script' ) ); - $this->assertEqualHTML( - '' . "\n", + "\n", wp_get_script_tag( array( 'type' => 'application/javascript', @@ -22,30 +20,14 @@ public function get_script_tag_type_set() { ) ) ); - - remove_theme_support( 'html5' ); - - $this->assertEqualHTML( - '' . "\n", - wp_get_script_tag( - array( - 'src' => 'https://localhost/PATH/FILE.js', - 'type' => 'application/javascript', - 'async' => false, - 'nomodule' => true, - ) - ) - ); } /** * @covers ::wp_get_script_tag */ public function test_get_script_tag_type_not_set() { - add_theme_support( 'html5', array( 'script' ) ); - $this->assertEqualHTML( - '' . "\n", + "\n", wp_get_script_tag( array( 'src' => 'https://localhost/PATH/FILE.js', @@ -54,8 +36,6 @@ public function test_get_script_tag_type_not_set() { ) ) ); - - remove_theme_support( 'html5' ); } /** @@ -72,8 +52,6 @@ static function ( $attributes ) { } ); - add_theme_support( 'html5', array( 'script' ) ); - $attributes = array( 'src' => 'https://localhost/PATH/FILE.js', 'id' => 'utils-js-extra', @@ -87,15 +65,5 @@ static function ( $attributes ) { array( $attributes ) ) ); - - remove_theme_support( 'html5' ); - - $this->assertEqualHTML( - wp_get_script_tag( $attributes ), - get_echo( - 'wp_print_script_tag', - array( $attributes ) - ) - ); } } From 291ae9d7645820f9adb779961bc5b06842a63e58 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Tue, 13 Jan 2026 23:14:46 +0100 Subject: [PATCH 3/6] Remove outdated type attribute doc comment --- src/wp-includes/script-loader.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index dd7dabd9eaa3d..f417b3171fa65 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2829,7 +2829,6 @@ function wp_enqueue_editor_format_library_assets() { /** * Sanitizes an attributes array into an attributes string to be placed inside a `\n", + '' . "\n", wp_get_script_tag( array( 'src' => 'https://localhost/PATH/FILE.js', From af87fbd801b57c104eb83f59748205e6e4869b38 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Thu, 15 Jan 2026 16:35:10 +0100 Subject: [PATCH 5/6] Revert stylistic change. --- tests/phpunit/tests/dependencies/wpScriptTag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/dependencies/wpScriptTag.php b/tests/phpunit/tests/dependencies/wpScriptTag.php index 2ac46f5a0d0b5..57ed857ff5d6d 100644 --- a/tests/phpunit/tests/dependencies/wpScriptTag.php +++ b/tests/phpunit/tests/dependencies/wpScriptTag.php @@ -10,7 +10,7 @@ class Tests_Dependencies_wpScriptTag extends WP_UnitTestCase { public function get_script_tag_type_set() { $this->assertEqualHTML( - "\n", + '' . "\n", wp_get_script_tag( array( 'type' => 'application/javascript', From d95735c23720dedeaecd4b32e39349b435d3a8ea Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Thu, 15 Jan 2026 16:36:59 +0100 Subject: [PATCH 6/6] Remove out-of-date documentation. --- src/wp-includes/script-loader.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 528f28c1438a4..e71b4d20e624e 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2874,8 +2874,6 @@ function wp_enqueue_editor_format_library_assets() { /** * Sanitizes an attributes array into an attributes string to be placed inside a `