Make WordPress Core


Ignore:
Timestamp:
08/25/2024 10:46:43 PM (6 weeks ago)
Author:
SergeyBiryukov
Message:

Script Loader: Do not normalize absolute paths in inline block styles CSS.

_wp_normalize_relative_css_links() used to normalize all non-absolute URLs regardless of whether it's a relative path or an absolute path. The normalization should only happen for relative paths (paths without a leading /) and not for absolute paths.

Reference: RFC 1808, Section 4, Step 4.

Follow-up to [52036], [52695], [52754], [55658], [55669].

Props scholdstrom.
Fixes #61909.

File:
1 edited

Legend:

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

    r57987 r58932  
    229229                'expected' => 'p {background-image: url(\'/wp-content/themes/test/../image1.jpg\');}',
    230230            ),
     231            'URLs with absolute path, shouldn\'t change'   => array(
     232                'css'      => 'p {background:url( "/image0.svg" );}',
     233                'expected' => 'p {background:url( "/image0.svg" );}',
     234            ),
    231235            'External URLs, shouldn\'t change'             => array(
    232236                'css'      => 'p {background-image: url(\'http://foo.com/image2.png\');}',
Note: See TracChangeset for help on using the changeset viewer.