Make WordPress Core


Ignore:
Timestamp:
01/23/2026 05:02:27 PM (7 months ago)
Author:
jonsurrell
Message:

Script Loader: Deprecate wp_sanitize_script_attributes().

The function is no longer used by WordPress and better alternatives are available: wp_get_script_tag() and wp_get_inline_script_tag().

Developed in https://github.com/WordPress/wordpress-develop/pull/10742.

Follow-up to [61415], [61485].

Props jonsurrell, westonruter.
Fixes #64511. See #64442.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/dependencies/wpSanitizeScriptAttributes.php

    r61415 r61518  
    1111
    1212        public function test_sanitize_script_attributes_type_set() {
     13                $this->setExpectedDeprecated( 'wp_sanitize_script_attributes' );
    1314                $this->assertSame(
    1415                        ' type="application/javascript" src="https://DOMAIN.TLD/PATH/FILE.js" nomodule',
     
    2526
    2627        public function test_sanitize_script_attributes_type_not_set() {
     28                $this->setExpectedDeprecated( 'wp_sanitize_script_attributes' );
    2729                $this->assertSame(
    2830                        ' src="https://DOMAIN.TLD/PATH/FILE.js" nomodule',
     
    3941
    4042        public function test_sanitize_script_attributes_no_attributes() {
     43                $this->setExpectedDeprecated( 'wp_sanitize_script_attributes' );
    4144                $this->assertSame(
    4245                        '',
     
    4649
    4750        public function test_sanitize_script_attributes_relative_src() {
     51                $this->setExpectedDeprecated( 'wp_sanitize_script_attributes' );
    4852                $this->assertSame(
    4953                        ' src="PATH/FILE.js" nomodule',
     
    6064
    6165        public function test_sanitize_script_attributes_only_false_boolean_attributes() {
     66                $this->setExpectedDeprecated( 'wp_sanitize_script_attributes' );
    6267                $this->assertSame(
    6368                        '',
     
    7277
    7378        public function test_sanitize_script_attributes_only_true_boolean_attributes() {
     79                $this->setExpectedDeprecated( 'wp_sanitize_script_attributes' );
    7480                $this->assertSame(
    7581                        ' async nomodule',
Note: See TracChangeset for help on using the changeset viewer.