Make WordPress Core


Ignore:
Timestamp:
09/29/2023 07:45:53 PM (10 months ago)
Author:
westonruter
Message:

Script Loader: Harden removal of script tag wrappers.

  • Add wp_remove_surrounding_empty_script_tags() to more precisely remove script tag wrappers and warn when doing it wrong.
  • Add clarifying comments for XML escaping logic in wp_get_inline_script_tag().
  • Leverage WP_HTML_Tag_Processor in test_remove_frameless_preview_messenger_channel.
  • Reuse assertEqualMarkup in test_blocking_dependent_with_delayed_dependency.
  • Normalize whitespace in parse_markup_fragment for assertEqualMarkup.

Follow-up to [56687].
Props dmsnell, westonruter, flixos90.
See #58664.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/manager.php

    r56695 r56748  
    31363136        ob_start();
    31373137        $manager->remove_frameless_preview_messenger_channel();
    3138         $output = ob_get_clean();
    3139         $this->assertStringContainsString( '<script', $output );
     3138        $processor = new WP_HTML_Tag_Processor( ob_get_clean() );
     3139        $this->assertTrue( $processor->next_tag( 'script' ), 'Failed to find expected SCRIPT element in output.' );
    31403140    }
    31413141
Note: See TracChangeset for help on using the changeset viewer.