mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Script Loader: Optimize performance of _wp_normalize_relative_css_links() by more than 2x.
* Replace `preg_match_all()` and its secondary `str_replace()` call with `preg_replace_callback()`. * Fix case where paths beginning with `http` and `https` (but not `http:` and `https:`) were erroneously not counted as relative. * Improve code style and readability by consolidating conditions and returning once. * Use `str_starts_with()` consistently instead of `strpos()`. Follow-up to [52036], [52695], and [52754]. Fixes #58069. See #54243. git-svn-id: https://develop.svn.wordpress.org/trunk@55658 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -240,6 +240,14 @@ class Tests_Dependencies_Styles extends WP_UnitTestCase {
|
||||
'css' => 'img {mask-image: url(\'data:image/svg+xml;utf8,<svg></svg>\');}',
|
||||
'expected' => 'img {mask-image: url(\'data:image/svg+xml;utf8,<svg></svg>\');}',
|
||||
),
|
||||
'URLs with path beginning with http' => array(
|
||||
'css' => 'p {background:url( "http-is-awesome.png" );}',
|
||||
'expected' => 'p {background:url( "/wp-content/themes/test/http-is-awesome.png" );}',
|
||||
),
|
||||
'URLs with path beginning with https' => array(
|
||||
'css' => 'p {background:url( "https-is-more-awesome.png" );}',
|
||||
'expected' => 'p {background:url( "/wp-content/themes/test/https-is-more-awesome.png" );}',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user