Script Loader: Prevent normalizing HTML IDs in `_wp_normalize_relative_css_links()`.

This change fixes an issue where `_wp_normalize_relative_css_links()` was not only matching urls, but also HTML IDs.

Follow-up to [52036].

Props mahype, costdev, audrasjb, SergeyBiryukov.
Fixes #54922.

Built from https://develop.svn.wordpress.org/trunk@52695


git-svn-id: http://core.svn.wordpress.org/trunk@52284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-02-08 23:41:00 +00:00
parent 2fa1d729ba
commit f76b77b7c3
2 changed files with 6 additions and 1 deletions

View File

@ -2770,6 +2770,11 @@ function _wp_normalize_relative_css_links( $css, $stylesheet_url ) {
continue;
}
// Skip if the URL is an HTML ID.
if ( str_starts_with( $src_result, '#' ) ) {
continue;
}
// Build the absolute URL.
$absolute_url = dirname( $stylesheet_url ) . '/' . $src_result;
$absolute_url = str_replace( '/./', '/', $absolute_url );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52694';
$wp_version = '6.0-alpha-52695';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.