#54922 closed defect (bug) (fixed)
Normalizing CSS also catches CSS IDs instead of only URLs
| Reported by: | mahype | Owned by: | audrasjb |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.9.1 |
| Component: | Script Loader | Version: | 5.9 |
| Severity: | normal | Keywords: | has-patch has-unit-tests has-test-info commit fixed-major |
| Cc: | Focuses: |
Description
The function _wp_normalize_relative_css_links which was introduced in WordPress 5.9.0 does not only preg matching urls, it also matches HTML ids.
The CSS property
clip-path: url(#image1);
will be replaced by
clip-path: url(/relative_url/#image1);
The clip path wont work anymore after this replacement.
Change History (13)
This ticket was mentioned in PR #2260 on WordPress/wordpress-develop by costdev.
5 years ago
#3
- Keywords has-patch has-unit-tests added
Trac ticket: https://core.trac.wordpress.org/ticket/54922
#4
@
5 years ago
Thanks @mahype for reporting this.
The above PR looks good to me.
We should also implement str_starts_with on other places for better consistency in a follow-up 6.0 ticket.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
5 years ago
#7
@
5 years ago
- Keywords commit added; needs-testing removed
- Owner set to
- Status new → assigned
I tested the proposed PR and it fixes the issue.
Using:
echo _wp_normalize_relative_css_links( 'clip-path: url(#image1);', get_stylesheet_uri() );
Result before patch:
clip-path: url(/552/wordpress-13/wp-content/themes/twentytwenty/#image1);
Result after patch:
clip-path: url(#image1);
The patch was reviewed by @SergeyBiryukov. It passes the unit tests.
Self assigning for commit.
#9
@
5 years ago
- Keywords fixed-major added
- Resolution fixed
- Status closed → reopened
Reopening for backport consideration.
5 years ago
#10
Committed in https://core.trac.wordpress.org/changeset/52695
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Test Report
Env
Steps to test
echo _wp_normalize_relative_css_links( 'clip-path: url(#image1);', get_stylesheet_uri() );Results
clip-path: url(#image1);clip-path: url(/wordpress-develop/src/wp-content/themes/twentytwentytwo/#image1);